Please Please! help me with a change image/animation on rotation! rule..

jay2dxjay2dx Member Posts: 611
edited January 2015 in Working with GS (Mac)

Hey Guys, Happy 2015 to you all :)

Been making a few games over the holidays and come stuck with an image change with rotation rule that I'm sure can be done better, I have this working "kind of" but it doesn't always work..

Ok so i have an image i am rotating clockwise and anti clockwise, think an asteroids ship, but i want the image to change as it goes around its rotation, like a plane flying through the sky!

I have the rule set up so that it checks its self rotation and is between certain degrees, and it changes the image when it moves around! but it doesn't always work!

Ive attached a project file with a quick sample of what i have so far for this mechanic, can someone please help or contribute to the code, or even is there a better way to do this!

Ive heard using a "floor" rule mite be better but I'm unsure hot to set all that up! is it like using a custom number font for scores i guess!

please anyways have a look at my file and if you can help id be most grateful :) and if i can help you with anything, maybe some graphics etc, let me know

Best

Jay...

Comments

  • colandercolander Member Posts: 1,610

    You need to constrain self.Rotation to a new self attribute and use modules to keep it between 0 and 360 otherwise after one turn the value goes out of that range. You can test and see this yourself using Text Display. Also you need to use a greater than and equal to operator in one of your conditions in all the positional rules to cover the whole range. For example as you had it 0, 35, 75, etc were not in the range because it was always creator or less than those values.

    I also started an expression to constrain the images to the actor it has the first two images done. If you finish it and get it working you can delete all the image change rules. You can copy and paste it in sections and change the values each time. Here is a link explaining how it works. Be careful when construction it any syntax error like a missed bracket and it won't work.

  • jay2dxjay2dx Member Posts: 611

    @colander thank you so much will have a look at this now :) really helpful of you so nice one..

    will see how this goes..

    Best

    jay

  • jay2dxjay2dx Member Posts: 611

    @colander this is great and exactly what i needed, the expression is really good thank you, i can get back to doing the enjoyable stuff, i.e. graphics etc,, thanks so much man, can't thank you enough

    Jay

Sign In or Register to comment.