scroll-wrap feature or workaround...
harrio
Member Posts: 234
hello gs,
i plan to try a 'defender' clone of sorts. it will be similar to your shooter example except that not only should it scroll, it should also seamlessly wrap the level or scene horizontally, or vertically i suppose, depending on the game type, as one 'world'.
i looked at your asteroid example and i can see how that might work. but, if the scene is larger than the camera and you scroll to one 'side' will the scene flash back to the other end/side of the scene.
i guess i'm asking if there is a way of implementing the 'defender effect' or is there some workaround/hack that you can suggest?
i plan to try a 'defender' clone of sorts. it will be similar to your shooter example except that not only should it scroll, it should also seamlessly wrap the level or scene horizontally, or vertically i suppose, depending on the game type, as one 'world'.
i looked at your asteroid example and i can see how that might work. but, if the scene is larger than the camera and you scroll to one 'side' will the scene flash back to the other end/side of the scene.
i guess i'm asking if there is a way of implementing the 'defender effect' or is there some workaround/hack that you can suggest?
Comments
you would just need some longer scene backgrounds and when each scene portion goes all the way off the screen(its position is negative half its width) then you can have a rule that checks this and the direction you are moving to do a Change Attribute on the X position to move it to the other end of screen at an exact point so it would look endless.
With the way wrapping works the whole image needs to leave the scene area before it will start to appear on the other end. So the method above should work. We are still working on perfecting that.
Hope that helps.
thanks for the response. i don't have my mac laptop yet, so i'm mapping out rules, actions and attributes with good 'ole pen and paper right now. is there any way you can visualize your 'method'. i'm not quite understanding it. my fault i'm sure. i put a mock up of what i'm trying to get here...
http://docs.google.com/Doc?id=dcrvmt6h_11fcddsrdp
Or did you want to "move right" and the buildings move left.
We've been busy working on a game that has something close to what you are looking for. The good news is that we have it nearly completely looking seemless. The bad news is it is in a build that is not yet on the site for release.
So the way we have it is we have 2 instances of the same actor prototype. That prototype has the image that scrolls. In your case, all of those buildings.
In the case below, the width of the actor is the width of the screen. i.e. 480
Have one rule that moves the actor right when the left button is pushed.
Have another rule that moves the actor left when the right button is pushed.
To have seemless scrolling, align the 2 instances next to each other and have these 2 rules:
Rule 1: When the X position is less than negative half its width AND right button is down
-> change attribute : The X position is set to its X position plus the width of the actor plus the width of the scene.
Rule 2: When the X position is greater than half its width plus the scene width AND left button is down
-> change attribute : The X position is set to its X position minus the width of the actor minus the width of the scene.
this sounds really juicy. i'm going to have to wrap my head around this setup.
don't worry, i won't ask the cliche question of when the next build will be out. i'll leave that to the others.
i'm going crazy waiting for my mbp to arrive!
The method above does that.
You would need 2 instances of the actor with the background, and place them next to each other.
So say I had an image that looks like it never ends when you connect the sides of it.
I make an actor that is the width of scene with that image. i.e. 480.
I create 2 instances of that actor so that they are right next to each other.
When it is all the way off the screen(i.e. its centerpoint is offset from the edge of the scene by half the width(or height) of the actor, then change the attribute value of the X position to the other side of the screen.
i had to read your explanation about 20 times and then i still had to do 'picture mode' so that i could figure it out. i hope this mock up makes it easier to understand for others. or maybe i'm the only dummy who didn't get it...lol
http://docs.google.com/Doc?id=dcrvmt6h_12fbrhgkcv
If it is okay with you, may I use that image as part of the How-Tos in the wiki?
Or if you want, you can add it to the wiki yourself and provide descriptions.
http://gamesalad.com/wiki/how_tos
sure you can use it! i'd be honored/geek'd.
even though i'm only working on pen and paper right now, still waiting for my macbook pro to arrive, i plan on making a screencast/tutorial with http://www.screentoaster.com
i think this would be great for others who want to contribute to the wiki too.
Thanks!
-Ed
Reading the above posts from 9 months back shows it can be done but the biggest issue with these rules is knowing how to use them without seeing examples.
Any help is most welcomed - thanks!
I'm in the process of determining how large my background should be. It seems that one wrapping 512x512 image would be more efficient than a 1000x8000 image.
// Red Dot Inc
That SHOULD fix it...
I was using a 1024x1024 image for iPhone 4 so 512x512, any issues with that you think?