-
[n00b][Question] About this engine I found...
onClipEvent(load) {
speed = 5;
}
onClipEvent(enterFrame) {
if (key.isDown(key.RIGHT)) {
_x += speed;
} else if (key.isDown(key.LEFT)){
_x -= speed;
} else if (key.isDown(key.UP)){
_y -= speed;
} else if (key.isDown(key.DOWN)){
_y += speed;
}
}
This is what I am using to make the character move, I am just testing this thing. I don't get one thing, what if I wanted to make the right arrow key make it go up? I do not see any reference to the direction except for the key and the negative and positive.
I know how to change left into right, and vice versa, and the same with up and down. Just wondering what makes it change so I can make the right key move the Symbol upwards.
Thanks.
-
Re: [n00b][Question] About this engine I found...
Originally posted by mrwackoisme
onClipEvent(load) {
speed = 5;
}
onClipEvent(enterFrame) {
if (key.isDown(key.RIGHT)) {
_x += speed;
} else if (key.isDown(key.LEFT)){
_x -= speed;
} else if (key.isDown(key.UP)){
_y -= speed;
} else if (key.isDown(key.DOWN)){
_y += speed;
}
}
This is what I am using to make the character move, I am just testing this thing. I don't get one thing, what if I wanted to make the right arrow key make it go up? I do not see any reference to the direction except for the key and the negative and positive.
I know how to change left into right, and vice versa, and the same with up and down. Just wondering what makes it change so I can make the right key move the Symbol upwards.
Thanks.
P.S. Those are called engines... right?
-
Yes we can
nope,the code you posted wouldn´t be called an engine.
the code to build the game world (maps for example),scroll the map,character control,enemy control,collision detection,sound control etc are just the parts,the sum of it all is the engine.(pretty much the whole codeside of the game).
_x is the _x property of a symbol,_y is the _y property.
in flash the coordinate system is left to right= x axis (the more right,the more positive the value)
top to bottom= y axis,the more to the bottom,the more positive the value (unlike the math coordinate system).
so if you want to move a movieclipsymbol to the right,you increase its _x propertie´s value,if you want to move it to the bottom,you increase the value of its _y property.
-
Oh, ok. Thanks very, very much!
Now I understand it, like a coordinate plane almost. Thanks again!
-
Yes we can
no probs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|