Game help?
- Sungopher
-
Sungopher
- Member since: Aug. 4, 2009
- Offline.
-
- Forum Stats
- Member
- Level 03
- Blank Slate
I have this code, and its not really working
onEnterFrame = function()
{
if(Key.isDown(Key.LEFT))
{
_root.map._x += 5;
}
if(Key.isDown(Key.RIGHT))
{
_root.map._x -= 5;
}
if(Key.isDown(Key.UP))
{
_root.map._y += 5;
}
if(Key.isDown(Key.DOWN))
{
_root.map._y -= 5;
}
}
_root.hero.play();
if(!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.UP) && !Key.isDown(Key.DOWN))
- MichaelJ
-
MichaelJ
- Member since: Mar. 2, 2009
- Offline.
-
- Forum Stats
- Member
- Level 18
- Voice Actor
Well you didn't provide enough information. It appears though, that your code is incomplete.
onEnterFrame = function () {
if (Key.isDown(Key.LEFT)) {
_root.map._x += 5;
}
if (Key.isDown(Key.RIGHT)) {
_root.map._x -= 5;
}
if (Key.isDown(Key.UP)) {
_root.map._y += 5;
}
if (Key.isDown(Key.DOWN)) {
_root.map._y -= 5;
}
};
_root.hero.play();
The above part should function correctly. But below...
if (!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.UP) && !Key.isDown(Key.DOWN)) {
//If? Then what?
} - Sungopher
-
Sungopher
- Member since: Aug. 4, 2009
- Offline.
-
- Forum Stats
- Member
- Level 03
- Blank Slate
Well ok, see what I'm trying to make is a game that follows the movement style like Zelda Minish Cap, and I can't seem to get the character to have a walking animation when I press the Arrow Keys. So if anyone can help with that, please help!


