Ok I have this a code that me and my friend ended up with now I can make a ball move easy but Im not sure how to make a stickmen using the key directions now my friend mainly knows the actionscript so this is basically what I want to do
1.Take out up and down keys and just go left and right
2.I can make a stickman animation but how do I make the option where if I hold right key down he runs I already tried
Ok here is the code
onClipEvent (load) {
power = 3;
radius = 6;
_x = 35;
_y = 40;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= power;
}
if (Key.isDown(Key.RIGHT)) {
_x += power;
}
if (Key.isDown(Key.UP)) {
_y -= power;
}
if (Key.isDown(Key.DOWN)) {
_y += power;
}
while (_root.wall.hitTest(_x, _y+radius, true)) {
_y--;
}
while (_root.wall.hitTest(_x, _y-radius, true)) {
_y++;
}
while (_root.wall.hitTest(_x-radius, _y, true)) {
_x++;
}
while (_root.wall.hitTest(_x+radius, _y, true)) {
_x--;
}
if ((_root.cop.hitTest(_x, _y+radius, true)) or (_root.cop.hitTest(_x, _y-radius, true)) or (_root.cop.hitTest(_x+radius, _y, true)) or (_root.cop.hitTest(_x-radius, _y, true))) {
_x = 35;
_y = 40;
}
}
I also have a wall so some of that is for the wall