Jump to content


Photo

Play sprite animation one time


  • Please log in to reply
5 replies to this topic

#1 Angelone

Angelone

    GMC Member

  • New Member
  • 22 posts

Posted 15 October 2011 - 03:52 PM

Hi i have a animated sprite with 5 subimage.

Is possible to play one time all images when user click on a button, and than stop to subimage n° 5

i have proble to code it.
May you help me, i have to give project to my Professor in mondey?
  • 0

#2 LOS.A

LOS.A

    GMC Member

  • GMC Member
  • 597 posts
  • Version:GM8

Posted 15 October 2011 - 04:08 PM

That's easy enough.
//Create event
image_speed = 0
image_index = 4

//Mouse button pressed event
image_index = 0

//Step event
image_speed = (image_index != 4)
The stuff in Step event could be replaced by this:
if image_index = 4
    image_speed = 0
else
    image_speed = 1
You should modify after which image you want it to display when on standby.

Edit: Is using GM in programming class a norm? I've seen many posts like yours.

Edited by LOS.A, 15 October 2011 - 04:09 PM.

  • 0

#3 mads2194

mads2194

    GMC Member

  • GMC Member
  • 368 posts
  • Version:Unknown

Posted 15 October 2011 - 06:02 PM

Or, you can try this:

//Create event
image_speed = 0

//Mouse button pressed event
image_speed = 1 

//Other: Animation end
image_speed = 0
image_index = 5

  • 0

#4 Angelone

Angelone

    GMC Member

  • New Member
  • 22 posts

Posted 16 October 2011 - 01:53 PM

Edit: Is using GM in programming class a norm? I've seen many posts like yours.


Hi LOS.A we use GM lite in our "cognitive technology" course, we use GM to developt games for the reabilitation of cognitive disabilities. Now i'm developing a game aroud the theories of famous psychologis J. Piaget.

Thank's a lot for your help.

Angelone
  • 1

#5 LOS.A

LOS.A

    GMC Member

  • GMC Member
  • 597 posts
  • Version:GM8

Posted 16 October 2011 - 01:56 PM

Ohh, that's very nice! I had no idea this was the case. I'm glad.
  • 0

#6 tsenna

tsenna

    GMC Member

  • GMC Member
  • 5 posts
  • Version:GM:Studio

Posted 15 November 2012 - 02:54 PM

Hey guys, sorry for bring this post back, but i would not create a new one :]
I'm on the same problem of playing one time, but it's not a separated object, it's with the main character.
i tried to think with the solution above, but if i code this on step event, it would happens with all animations.
i want the char to attack (1 time animation) and then come back to standing animation.

sorry for anything i'm also learning all this tool.
thanks for the patience :thumbsup:

Edit: Figured out!

Edited by tsenna, 16 November 2012 - 05:11 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users