GMS 2 Animation in GameMakerStudio2 basic GML

Zollock

Member
Hello there, I've been watching some Shaun Spalding videos to make a platformer, but my character needs additional animations like Starting to walk,inbetween frames for jumping and falling, turning and landing animations.
I know how to add that in DnD in Game Maker 8 but I'm just starting with GML
Any help you could give me? I've attached an image of the code I have so far
Just in case the comments in spanish read from top to bottom: Controls, Movement, Horizontal collision, Vertical collision,Animation
Other thing I'm curious about, how could I instead of calling the animations just telling the program to "Use the current animation" so later I could assign different animations for the same action like Walking with an armor, walking injured, etc without making 100 questions in the script every time I want to animate
 

Attachments

Yal

🐧 *penguin noises*
GMC Elder
how could I instead of calling the animations just telling the program to "Use the current animation"
The current sprite is stored in the variable sprite_index, the current subimage in image_index. If you handle animation yourself, you could probably make a similar animation_index variable to store the index of the animation.
 

Nidoking

Member
I use a lot of state variables for that and set the appropriate sprite_index in the Begin Draw or Pre-Draw event, resetting image_index if the sprite_index has changed. Yes, the logic becomes complicated. You can put it in a script, but that doesn't really do much to distinguish it from just doing it right in the event.
 
Top