Do you know the best way to simulate flying??

twinpixtwinpix Member Posts: 49
edited November -1 in Working with GS (Mac)
I am developing a game with a plane "flying" in the center of the screen. The plane doesn't actually move so to simulate flying, I have trees below it that scroll left to right.

Basically the Tree behavior I created moves the Tree to off-screen far right after it passes the left side of the screen and out of view. Then it just continues looping across the screen and makes the plane look like it's flying.

Tree Actor:
Move: (direction 180, Speed 200, Relative to Screen)
Rule: When (self.Position.X) < (-self.Size.Width) then Change Attribute (self.Position.X) to (game.SceneWidth +500)

Is this the best way to implement this? Should I use Spawn Actor/Destroy Actor instead?
I'm hoping to have lots of actors moving like the trees and I need the best way to manage memory so it will play at a fast frame rate.

Suggestions?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi twinpix, would the Basic ShootEm Up template be useful for you here?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • twinpixtwinpix Member Posts: 49
    Yes, it is similar to Basic ShootEm Up template. I'm concerned about how Spawning Actors uses memory. If they never get destroyed do they eventually fill up memory? Is it better to have the actors destroy themselves after they move off screen left (and spawn a new actor off screen right) or just move it with a Rule?
  • jweaver911jweaver911 Member Posts: 439
    I think most people here would tell you that it would be better to simply "re-use" items by changing their location back to where they are to "spawn in" and not destroy. The "Spawn" and "Destroy" method adds a lot more CPU strain than the aforementioned one. Does that help?
  • twinpixtwinpix Member Posts: 49
    Yes! That answers my question. Thanks jweaver911!
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Have you tried flapping your arms?
  • AfterBurnettAfterBurnett Member Posts: 3,474
    twinpix said:
    Yes, it is similar to Basic ShootEm Up template. I'm concerned about how Spawning Actors uses memory. If they never get destroyed do they eventually fill up memory? Is it better to have the actors destroy themselves after they move off screen left (and spawn a new actor off screen right) or just move it with a Rule?

    I'll be helpful on this one :-)

    Destroying actors does not release them from memory. This is ridiculous and needs to be fixed by Gendai FAST.
Sign In or Register to comment.