Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 04:24:47 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsAnimating
Pages: [1]
Print
Author Topic: Animating  (Read 2769 times)
Conker534
Guest
« on: June 18, 2011, 11:18:46 PM »

Well I'm lost. I can't figure out how to make my player switch to spr_player_run, I do it in the step event, but it keeps calling it so it doesn't animate.. Can someone please help me?

Here is my player step event.

Code:
//Gravity
if (place_free(x,y+1))
{
    gravity_direction=270;
    gravity=0.6;
}
else
{
    gravity_direction=270;
    gravity=0;
};

//Jumping
if (keyboard_check(ord("W")))
if !place_free(x,y+1)
{
    vspeed=-6.4;
};

//Movement Right
if (keyboard_check(ord("D")))
if (place_free(x+4,y))
{
    x+=4;
    y=y;
    image_xscale=1;
};

//Movement Left
if (keyboard_check(ord("A")))
if (place_free(x-4,y))
{
    x-=4;
    y=y;
    image_xscale=-1;
};

Sorry if its messy.. :I
Thanks for the help!
Logged
poe
Guest
« Reply #1 on: June 19, 2011, 10:19:50 AM »

Code:
if image_index != spr_player_run{image_index=spr_player_run;sprite_index=0;}

Might need to flip image and sprite index, I'm a bit rusty lol
Logged
Geeze
Level 5
*****


Totally.


View Profile
« Reply #2 on: June 20, 2011, 09:42:17 PM »

Code:
if image_index != spr_player_run{image_index=spr_player_run;sprite_index=0;}

Might need to flip image and sprite index, I'm a bit rusty lol
True dat.
Sprite_index represents current sprite and image_index current subimage
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic