开发者

Help with logic for a Matching game in As2

开发者 https://www.devze.com 2023-02-09 05:38 出处:网络
I was given a task to make a match making game in actionscript 2, problem is, i have very little knowledge about the language (well,.. really, I am not that good a programmer). So i was wondering if y

I was given a task to make a match making game in actionscript 2, problem is, i have very little knowledge about the language (well,.. really, I am not that good a programmer). So i was wondering if you guys can help me with the logic of the game, and how matching works in as2, what are the important codes, code emplacements, and all.. I am new in AS2, and i really need a lot o开发者_运维技巧f help with our project. :)

I plan to match images. But.. I was planning to have a sort of "Compatibility" match-up game, like,..let's say we have two batteries, one has a 50v capacity(how do u measure batteries?) then the other has a 100v capacity, then there's this battery slot that only accepts a 50v battery, then you will have to match this 50v battery to that battery slot, that's my concept for the game, sir. I hope you got what i said, sir. :D


In case with batteries, you simply need to create class slot and class battery they could extend Sprite class, so it will be easier for you later to work with object on stage.

class Slot extends Sprite {
  public var capacity:Number;

  function Slot(c:Number) {
    capacity  = c;
  }
}

class Battery extends Sprite {
  public var capacity:Number;

  function Battery (c:Number) {
    capacity  = c;
  }
}

Add some graphics to the classes, after add on stage some slots and batteries. I suppose there will be some drug and drop, and when user will try to drop battery into the slot, you will check

if(slot.capacity == battery.capacity){
  //input battery into slot
}else{
  //put battery back to box
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消