[SOLVED] x-speed from slide block

havana24

• Posts: 508
Hi,

Is there a way to calculate the x-speed of an actor that moves with the slide block?
I've tried with the classic equation like speed = space / time but it doesn't work...
If I try to move another actor with the result of this equation it doesn't move at the same speed.
What I've to put in "space"? The pixel value of the movement?
Is there any solution?

Alessandro

« Last Edit: June 09, 2013, 11:59:01 pm by havana24 »
My Website: www.havana24.net

• Posts: 1795
I think you can only find the speed if you set that slide block to move a certain number of pixels (so make sure you have Slide self BY <number_of_pixels>) and you have no effect on it (like Back In/Out, Strong In/Out or any other options in that drop down menu ). The rest is like you said...the time you have it set in the block, and also the space is the number of pixels you have in there.
Do keep in mind that if you do use the effects in that drop down menu you're adding acceleration into the mix and the math changes a little (actually it's only very hard to calculate if the acceleration is not constant), and if you plan on using the slide bloc without those effects you're basically achieving the same thing as using Set x-speed of self.

« Last Edit: June 09, 2013, 06:06:56 am by SadiQ »
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

havana24

• Posts: 508
As SadiQ said, I was in the right path with the speed formula.
I've tried some edits to the formula and finally I did it!

To detect the speed of an actor that moves with slide block you have to apply this formula
Speed = Space (Pixel of the movement) / Time (Seconds x 10)

Cheers,
Alessandro
My Website: www.havana24.net