PowerUps from the Top?

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
Here's what I want to do...

I want PowerUps to drop down from the top of my game (the game is one scene and the camera doesn't move...it's a casual game).

I need to recycle the actors so that they can be used again and again throughout gameplay...

Here's what I have...
Invisible actor that generates a random number between 1 and 11 (there are 11 total power-ups).
All 11 Power-Up actors are above the scene (out of sight).

Example PowerUp Actor: PowerUpActor1
RULE: When PowerUpNumber = 1
Accelerate 270 Degrees (down) at a speed of 200.

RULE: When PowerUpActor1 collides/overlaps with Player
*DO POWER UP ACTIVITY*
Change attribute PowerUpNumber to 0,
Change attributes self.position.X and self.position.Y *to above scene*

1. How can I get the powerup to not continue falling?
2. Is this the best way to do this?
3. Can I use interpolate instead and make the actor NON-MOVABLE? Would I have to make it's alpha 0 when it collides with the player?

Comments

  • DrGlickertDrGlickert Member Posts: 1,135
    Thanks TSB! Appreciate you're input! :-)
  • okimokiokimoki Member Posts: 159
    tshirtbooth said:
    Because of the amount of actors you have in your game i think it would be better for you to spawn and destroy the power ups.

    TSB: hmmmm.. any guidelines on when to spawn and when to recycle then?? I've read so much of "UUUUUU, DONT SPAWN!!!!" around the forum that i taught that it's never a good idea to spawn actors..
    sooooo.. when to spawn and when to recycle?? :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    its not as black and white as that. Say your doing a shooter, you can have only a couple offscreen and make them look like your spawning hundreds while shooting, so it woulod be alot better to recycle them.

    But say your trying to do a unlimited game with powerups, youd have to have like 50 powerup offscreen and thats not good. Youll take more of a performance hit having alll those actors offscreen, then spawning and destroying a power up now and then

    edit: tshirt beat me ;)
  • okimokiokimoki Member Posts: 159
    He beat you but you bet him in explanation ;) thanks to both of you! :)
  • gazjmgazjm Member Posts: 578
    If after your change power up number to 0 rule, you have a change attribute and set self.motion.linearvelocity.y to 0, that should stop it from moving.

    If you do it before you change the number to 0, it will accelerate again.
Sign In or Register to comment.