PDA

View Full Version : Combination key help


prosp3ct
12-06-2007, 06:47 AM
hi I'm new to actionscript technically but i'm trying make a game (which is development as I Speak) and i just need to know how to combine Key.[action] because I'm working on a COMBO system as well as a SPECIAL move system but i can't figure out if I'm writing it wrong or just messing it up some how.

i'll give you an example of my code

its basic until i finish up a few things

example:

onClipEvent (keyDown) {
//var for bind
db = Key.ENTER && Key.PGUP;

if (Key.getCode() == Key.RIGHT) {
this._x += 5;
} else if (Key.getCode() == Key.LEFT) {
this._x += -5;
} else if (Key.getCode() == Key.UP) {
this._y += -5;
} else if (Key.getCode() == Key.DOWN) {
this._y += 5;
}
//double bind config v 1.0//
else if (Key.getCode() == db)
{
// special

}
}
and please tell me if I'm in the wrong thread because I'm not sure if this is AS 1.0 or 2.0 *gulp* *light laughter* please get back to me ASAP PLEASE I'm making this game for my little cousins

grass
12-06-2007, 11:38 AM
onClipEvent (keyDown) {
//var for bind

//so not sure about this line... seems weird syntax
db = Key.ENTER && Key.PGUP;

if (Key.getCode() == Key.RIGHT) {
this._x += 5;
} else if (Key.getCode() == Key.LEFT) {
this._x += -5;
} else if (Key.getCode() == Key.UP) {
this._y += -5;
} else if (Key.getCode() == Key.DOWN) {
this._y += 5;
}
//double bind config v 1.0//
//try this
else if (Key.isDown(Key.ENTER) && Key.isDown(Key.PGUP))
{
// special

}
}

prosp3ct
02-05-2008, 03:50 AM
thank you i've figured out the set up :) i'll be setting up new things now i'll show you when i'm in the beta stage of the game.