Push moving actor down and let it return back on track after some time?

Almakos

  • Posts: 632
Hi,
I have actor moving back and forth horizontally on screen. I want to drop something on it, so that will push him down for some value and then while continuing movement on x, I want actor to return to his initial y.
I was trying to use tweening, but that will stop actor's x movement.
How would I do that if possible?
Thanks

« Last Edit: June 13, 2012, 04:31:13 am by Almakos »
Fishing Fantasy Trailer


Almakos

  • Posts: 632
things become even more complicated, because I don't want to use weight of actors, so my patrolling actors are like platforms (cannot be pushed)
Fishing Fantasy Trailer


Satyre

  • *
  • Posts: 270
Did you try to use a fixed y value and negate it after some time in a loop like this?

It simulates a frequently up and down movement. The Y value should be checked, cause I think it is too high, but the behaviour should work I think.

Almakos

  • Posts: 632
Unfortunately I cannot see second attachment for some reason, but I think I get the idea. Thank you!
Fishing Fantasy Trailer


I believe the second attachment is an exported behavior resource, meant for you to import into your own project to start using immediately.  :)

I'm guessing that based on the PNG's name, anyway...

Almakos

  • Posts: 632
Oh, I didn't know that, thank you =)
Anyways I have just implemented this technique and it works beautifully.


never would have guessed that png is something I should drop to Stencyl to get the code  :)
Fishing Fantasy Trailer


never would have guessed that png is something I should drop to Stencyl to get the code  :)
Yeah, if you export a behavior from Stencyl, it exports as a PNG.  I think (think?) the code/logic gets stored in some of the PNG's metadata.  A bit unexpected or strange at first, but ultimately helpful.