hobbes_and_me
03-03-2003, 09:12 PM
Can someone familiar with actionscript please tell me what's wrong with this codes:
function moveStuff() {
if (Key.isDown(Key.LEFT)) {
dr = 1;
}
if (Key.isDown(Key.RIGHT)) {
dr = 2;
}
if (Key.isDown(Key.UP)) {
dr = 3;
}
if (Key.isDown(Key.DOWN)) {
dr = 4;
}
if (dr=1) {
this._x -= 5;
}
if (dr=2) {
this._x += 5;
}
if (dr=3) {
this._y += 5;
}
if (dr=4) {
this._y -= 5;
}
}
ball.onEnterFrame = moveStuff;
This is part of my game i am programming. I have done this game in True Basic and it works out totally fine but I am totally sucky at Flash Actionscripting cause i don't know a thing about how it works, loops, continuous checking of variables and moving stuff continuously.
By the way, i'm not trying to make a dot move when you press the directional keys, i'm trying to make it move continuously in a direction, like in the game "Snake".
function moveStuff() {
if (Key.isDown(Key.LEFT)) {
dr = 1;
}
if (Key.isDown(Key.RIGHT)) {
dr = 2;
}
if (Key.isDown(Key.UP)) {
dr = 3;
}
if (Key.isDown(Key.DOWN)) {
dr = 4;
}
if (dr=1) {
this._x -= 5;
}
if (dr=2) {
this._x += 5;
}
if (dr=3) {
this._y += 5;
}
if (dr=4) {
this._y -= 5;
}
}
ball.onEnterFrame = moveStuff;
This is part of my game i am programming. I have done this game in True Basic and it works out totally fine but I am totally sucky at Flash Actionscripting cause i don't know a thing about how it works, loops, continuous checking of variables and moving stuff continuously.
By the way, i'm not trying to make a dot move when you press the directional keys, i'm trying to make it move continuously in a direction, like in the game "Snake".