0 Replies - 912 Views - Last Post: 28 May 2014 - 06:09 AM Rate Topic: -----

#1 fefekobernik  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-May 14

Action Script 2 Coding for score error?

Posted 28 May 2014 - 06:09 AM

I have been fussing with this coding for the score to show up. I just want to have a simple shooter game where a ship is shooting at the enemy. It works with everything else, but it doesn't show the score.

Here is my code I have now.

var lives = 3;
var score = 0;
var nrEnemies = 3;
for(i = 1; i < nrEnemies; i++)
{
	_root.Enemy0.duplicateMovieClip("Enemy" + i, _root.getNextHighestDepth());
}
var i=0
this.onEnterFrame = function()
{
	if(Key.isDown(Key.RIGHT))
{
if(Ship.hitTest(550, Ship._y, true))
{
	Ship._x -=5;
}
Ship._x += 5;
}
else if(Key.isDown(Key.LEFT))
{
	if (Ship.hitTest(0, Ship._y, true))
	{
	Ship._x +=5;
	}
Ship._x -= 5;
}
else if (Key.isDown (Key.UP))
{
	if (Ship.hitTest(Ship._x - 40.0, true))
	{
		Ship._y += 5;
	}
	Ship._y -= 5;
}
else if (Key.isDown(Key.DOWN))
{
	if (Ship.hitTest(Ship._x - 40, 400, true))
	{
		Ship._y -= 5;
	}
Ship._y += 5;
}
if(Key.isDown(Key.SPACE))
{
	i++;
	_root.attachMovie("Bullet", "Bullet" + i, _root.getNextHighestDepth());
	_root["Bullet" + i]._x = Ship._x+53;
	_root["Bullet" + i]._y = Ship._y+10;
	var shoot_sound = new Sound();
	shoot_sound.attachSound("shoot");
	shoot_sound.start();
}
}



I am new at this coding and not sure if I missed something? I've searched for examples like mine, but nothing has helped.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1