best way to bring various actors across side scrolling screen?
![app-etite](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hi guys,
My game is an automatic run and press to jump game side scroller.
Whats the best way to bring objects in from the right to left, Im looking for a way that is good on memory saving because the only way I know is to have all my objects just outside the screen and have them move on individually from a timer.
any suggestions?
Thanks
Appetite games
My game is an automatic run and press to jump game side scroller.
Whats the best way to bring objects in from the right to left, Im looking for a way that is good on memory saving because the only way I know is to have all my objects just outside the screen and have them move on individually from a timer.
any suggestions?
Thanks
Appetite games
Comments
Im a beginner so please elaborate.
Thanks
Thanks for the replies
I have approximately 10 actors (objects) that my character has to jump over. I want them scrolling on screen from right to left.. so although i have 10 actors i will need them to repeat again and again.
The only way i know how to have the actors moving across screen, is to have all my actors dropped in just off screen and use the move attribute at this or that speed. But obviously having all those actors there at one time is terrible for memory usage which is now up to 26mb when viewing the gameplay.
any help please??
-appetite games
Create a game intiger attribute called obstacle
Create a boolean attribute in each obstacle called move
Create an actor or anything to use as your randomiser. Add a timer in it and say
every X seconds change attribute game.obstacle random (1, however many obstacles there are)
Assign a number to each obstacle and create rule when game.obstacle = the number you assigned
change attribute self.move to true
Create a second rule when self.move=true
move actor at 180 speed 90 (something like that) If you want to interpolate instead of move then say interpolate position x to -50 select linear and have a duration of 1. If you want it slower make the duration bigger.
Create a third rule When Attribute self.position.X < - self.Size.Width /2
Change attribute self.position.X to self.Position.X + self.Size.Width + game.Display Size.Width AND change self.move to false.
Place each actor just out of view of the camera on the right.
This is at least what I use, not sure if it's the most efficient but seems like the best solution.
If your obstacles are the same size this may save more memory:
Create a game intiger attribute called obstacle
Create a boolean attribute in each obstacle called move
Create another game intiger attribute called image
Create an actor or anything to use as your randomiser. Add a timer in it and say
every X seconds change attribute game.obstacle random (1, however many obstacles there are on screen at any one time)
Create a single prototype actor and chuck all of these rules in there.
What is the maximum number of obstacles on screen at any one time, lets say its 3. So drag 3 copies of this prototype onto your scene on right hand side. Assign a number to each obstacle 1,2 and 3 and create rule when game.obstacle = the number you assigned
change attribute self.move to true AND change attribute game.image to random (1, however many images of obstacles you have)
Assign each image with a number and create a second rule thats says when game.image = the assigned number
change image to the image you assigned.
Create a third rule when self.move=true
move actor at 180 speed 90 (something like that) If you want to interpolate instead of move then say interpolate position x to -50 select linear and have a duration of 1. If you want it slower make the duration bigger.
Create a fourth rule When Attribute self.position.X < - self.Size.Width /2
Change attribute self.position.X to self.Position.X + self.Size.Width + game.Display Size.Width AND change self.move to false.
So with this method you only have one prototype and only 3 actors on scene but all 10 obstacles.
Hope that helps