I have a bit of a problem with my player-spaceship. I want to change sprite index when ever the player goes left or right. This part I have solved, but my friend thought that there should be a smoother animation so I created this new sprite sheet:

Now the code for the old spritesheet I have been using looks like this:
image_index=0;
image_speed=0;
if keyboard_check(vk_right) and x<950 then hspeed = speedpos;
if keyboard_check(vk_right) {image_index=1};
if keyboard_check(vk_left) and x>50 then hspeed = speedneg;
if keyboard_check(vk_left) {image_index=2}
if keyboard_check(vk_down)and y<view_yview +750
vspeed = speedpos;
if keyboard_check(vk_up) and y>view_yview+50
vspeed = speedneg;
First of all, can this code be shorter, and how do I add the rest of the sprites when the player goes left or right?
Thanks
regards
Tobias
Edited by animator75, 15 September 2012 - 02:44 AM.











