Request to masters for making important behavior for the community.

1MrPaul1

  • *
  • Posts: 1268
I think, almost for all games we need one very usefull behavior, I can't find it on forge and my knowledge of sw and mathematics do not enough for this goal.
So, I'm talking about behavior that will rotate actor on specific angle that depends from direction of the actors motion. i mean if actors x speed =  0 and y speed > 0, make actor facing right when motion etc. I thing it will be very usefully for every game for different purposes. I use shooting on 12 oclock behavior, and use only round bullets, because only this shape looking good in all angles, but using always round bullets it's not good I think... So, may be it's possible to calculate angle of motion from x and y speed and than using it for rotating of actor on this angle when created?   

Miasmos Games

  • Posts: 878
Not fully sure, but try "point [self] towards [direction] degrees".

Cupcake Bounce

Alexin

  • *
  • Posts: 3132
Use the block "atan2" to get the angle from the actor's y-speed and x-speed. Then, use the block Miasmos mentioned to rotate the actor.
"Find the fun"
alexin@stencyl.com

1MrPaul1

  • *
  • Posts: 1268
So, tried to use atan2 and point self, in this variant it's not working, bullets not rotated. Of cause may be I did everything wrong, but do as can.
And I tried to rotate on angles that I can calculate in mind(90, 180, 270,0) and have another difficulty, if I shoot 12 bullets in one time, and rotate first bullet, next bullet rotate on the same angle as first plus angle of self, I mean, all bullets of the same type rotate together and I don't know how to make bullets rotate separately.

Alexin

  • *
  • Posts: 3132
Quick guess: convert the angle returned by atan2 to degrees and place the block in "always".
"Find the fun"
alexin@stencyl.com

1MrPaul1

  • *
  • Posts: 1268
And again Alexin, you're amazed me, everything works excellent, exactly what I need, Thank you very much! You're just solved many and many of my in game problems. Later upload this behavior on forge, it's very cool working with "shoot around" behavior

1MrPaul1

  • *
  • Posts: 1268
Another question to masters, how to disable esc and right mouse functions of Flash player? I want to make game menu when esc is pressed (as usually in games) but this button just remove full screen mode now, it's very uncomfortably...