Combining the spriteSheets with the frames as an array of images seems to provide better performance. No example is really complete without the use of particles so I had to add some fun there. The ship uses atan2 to generate the angle between the sprite and the mouse location. Then the ship adjusts its Y […]
Matching games are a great way to learn about using arrays. I have worked with a number of ways to build the game logic for creating matching games over the years. I found an example of how to construct one in an article by Emaneule Feronato. The challenge that I wanted to explore was how […]
Sometimes you just want somebody to chase you. [as3] private function ai():void { //calc dist var tempDist=Math.sqrt(Math.pow(player.x-enemy.x,2)+Math.pow(player.y-enemy.y,2)); //trace(tempDist); if(tempDist<150) { enemy.rotation=Math.atan2((player.y-enemy.y),(player.x-enemy.x))/Math.PI*180; //calc h or v move if(Math.abs(player.x-enemy.x)>Math.abs(player.y-enemy.y)) { //move toward player on x axis first if(player.x>enemy.x) { //player is to the right of enemy enemy.x+=2; } else { //player is to the left of enemy […]
Welcome to theArtboy. Visit my unicorn or scream games.