Game Development Community

Camera Scrolling

by StandardFace · in iTorque 2D · 09/15/2009 (5:24 pm) · 4 replies

Greetings,

I am looking for suggestions on how to handle a certain type of camera. I am looking to make a scrolling camera similar to what you would find in a side scroller, or a top down shooter, that allows the 'play area' to be bigger than what is displayed on the iPhone. I have already tried a few methods, but all of them involve running a schedule that loops. and updates every 1 second, and this creates a lag instead of a smooth scrolling camera.

I am aware that through torque script only, using a scheduled event more often than every 1 second would kill the framerate. I am interested in doing this any way that I can, so I am not opposed to doing this in C, but I wouldn't know where to begin. Can someone perhaps give advice in this area?

Example scripts are welcome, as are any ideas as to how I could do this. Also, I have heard people talk about before the fact that any image size over 1024 square would kill the phone too. Suggestions to counter this are to use a tilemap, but can someone tell me how they would do it? do tiles out of the 'play area' not draw? Or would I just turn the tiles on as my camera passed over them?

Any help or ideas is greatly appreciated.

-StandardFace

#1
09/15/2009 (9:49 pm)
For the camera you can just mount it to your hero. you can also play with the force amount to create a smooth movement. worked very well for me in "Sushi To Go"
#2
09/15/2009 (11:09 pm)
Ok, so after some searching I am able to get:

sceneWindow2D.mount(%this);

This seems to work flawlessly. This is more or less how you achieved it in "Sushi To Go?"

Thank you for the help, sometimes all a person needs as help is the right terms to search the forums for. =)

-SFS
#3
09/15/2009 (11:31 pm)
yep, I used something like sceneWindow2D.mount(%this,0,0,%force);
So if you use %force=2 you will get a much smoother pan. play around with this value...
#4
09/16/2009 (1:12 am)
Thank you Eyal.

-SFS