So far it is in a class and I can spawn one onscreen which im happy about.
I can also make it move and collide with the tiles, which again im happy about.
What im not too happy about is how to make it have 'goomba' movement, as its not working
What I aim to do is have a 'enemy tile map', much like a tile map but instead creates a new enemy for each corresponding or respective number. So far I have it moving to the right, and when it collides with a wall tile what I want it to do is move in the opposite direction but I dont know how to do this.
Ive tried simple things like:
Code: Select all
x++;
if( ( collided_with_wall )&& (xvelocity greater then 0 ) ) //hit wall while moving right
{
x - xvel;
x--;
}
else
if ( collided with wall, and xvelocity less then 0 ) //hit wall while moving left
{
x += xvel;
x++;
}
Oh and how do I create the enemies from a enemy tile map? Better asked is how do I create more then one instance of the enemy? Im guessing its
new Enemy( x,y,variable); with the x and y variables being read from the map, btu when I tried it it didnt work. Ill try again but If you know thanks in advance