Be a Supporter!

Game help?

  • 286 Views
  • 2 Replies
New Topic Respond to this Topic
Sungopher
Sungopher
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Game help? 2009-08-29 11:25:41 Reply

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
Response to Game help? 2009-08-29 11:34:17 Reply

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? 
}

BBS Signature
Sungopher
Sungopher
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Game help? 2009-08-29 11:41:32 Reply

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!