Move Platform in a Circle

twinter3

  • Posts: 98
I am trying to develop a platform the rotates around a point.  The rotate around a point behavior that ships with 3.0 seems a bit jerky when applying it to a platform the actor is standing on, I am not sure if it is because it is using x,y postion instead of x,y speed or what.  Any theories out there to create circle movement using x,y speed?  I want to create something like this (in 2d of course) http://oyster.ignimgs.com/franchises/images/00/05/536_reznor_normal.jpg

Thanks!

« Last Edit: February 09, 2013, 02:49:19 pm by twinter3 »

Tuo

  • *
  • Posts: 2469
Circular movement in x-speed and y-speed is nasty and uses trig. Using a velocity (and then grabbing the x-speed and y-speed if you need as those will get updated by a velocity setter too) is not ;). Just use an attribute (i.e. "Angle") to store the direction for it to go and slowly increment it. For example:

Always
   set velocity to dir Angle, speed 30 (or whatever you want) for self
   increment Angle by 1.5 (or some other small number)

If you want to see a coding using this, you can search in the StencylForge for "Demo-" and find my "Demo- Off Screen Actors" and look at the second method extended. Those enemies go in a consistent circle using this idea.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

twinter3

  • Posts: 98
So simple and it works great!!!  Thank you!  :)

twinter3

  • Posts: 98
One last question, sorry, I have a hard time wrapping my head around the idea of starting one at the top and one at the bottom, so they go around the same path but one is right below.  Would I just adjust the angle using:

Always
   set velocity to dir Angle, speed 30 (or whatever you want) for self
   increment Angle by 1.5 (or some other small number)

They seem out of sink.  Thanks again!!!!

twinter3

  • Posts: 98
I figured it out, it was the angle.  I need sleep, thanks again!

Tuo

  • *
  • Posts: 2469
I'm glad it's working for you :).
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)