Change Velocity problem

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited February 2012 in Working with GS (Mac)
Hi guys

I'm having problems with getting an actor to do what it's told lol

I have a missile spawn actor that spawns a 'Missile' actor at x-50 and y160 when the score reaches a certain score. This allows the missile to move onscreen which i use a 'Move To' attribute for (move to x=32 / y=160) so it scrolls and sits in the middle of the screen...that's easy

No I want it to start to rise up the edge of the screen (Constrained to x of 32) and when it hits y=300 go back down the screen and when it hits y=32 go back up - this should repeat until the missile is pressed and I use a 'Change Velocity' attribute and fire it right at a speed of 500.

All it does when it appears onscreen is stay at x=32 and y=160.

What am I doing wrong?

I have the change velocity on the x and y linked to Actor and I thought that might be the problem so have changed the x velocity and y velocity to Scene but that makes no difference.

Please help...thanks guys

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hey @Zombiebrains

    Try interpolate instead of change velocity.

    Rule:
    When attribute self.position x = 50
    When attribute self.position y = 160
    Interpolate self.position y to 300.

    Rule: When attribute self.position y = 300
    timer, after 0.2 seconds, interpolate self.position y to 160

    Rule: When attribute self,position y = 160
    interpolate self.position y to 160

    That should help.

    Bray
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hey Braydon

    Thanks a lot for that cool plan...will try that now and report back! :)
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    That's good but it just stops in the middle and goes up again, can you change it so it goes down to the bottom of the screen say to y=50

    Thanks dude.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Sure thing.

    Just do this then:

    Rule:
    When attribute self.position x = 50
    When attribute self.position y = 160
    Interpolate self.position y to 300.

    Rule: When attribute self.position y = 300
    timer, after 0.2 seconds, interpolate self.position y to 50

    Rule: When attribute self,position y = 50
    interpolate self.position y to 300

    All you have to do is change the y position.

    Bray
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Thanks mate, your a star! :)
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    edited February 2012
    That sort of made the missile get stuck at y=160. It would work the first time, then as it goes up to 50 and back down to 300 it would only get as far as 160 and just go 160 - 50, 50 - 160 and repeat.

    I have sort of fixed it with spawning the missile at the top of the screen and move it to y=270 to goto 50. Then an attribute - if y=50 to go 270..that works fine and it now goes up and down the whole left edge of the screen.

    Thanks for the insight into Interpolate. I only use that for changing alpha colour - e.g. to fade things in and out. I didn't know you could use it to move things too...

    Thanks for all your help mate :)
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    No problem, Anthony.
    Glad to help.
Sign In or Register to comment.