making a camera scroll smoother
by rennie moffat · in Torque Game Builder · 10/15/2009 (11:21 pm) · 5 replies
sceneWindow2D.setCurrentCameraPosition(%CameraPointX* 0.5, 0); // the * 0.5 makes the camera move a little smoother // it also makes the camera move only %50 so if you where to add this code to a platformer delete the 0.5
this code is part of the cameraScrollX behavior for the UFO tut, here
http://tdn.garagegames.com/wiki/TGB/Tutorials/Alien_Invasion#Making_the_behavior_for_the_UFO
What I am wondering is, why would reducing the X position of the camera (%CameraPointX * 0.5) to half of it's natural postion would make the camera run smoother, as its creator states.
full function
function CameraScrollerX::onUpdate(%this)
{
%CameraPointX = %this.owner.getpositionX();
if(%CameraPointX < %this.MinX)
{
%CameraPointX = %this.MinX;
//makes it so the camera doesn't go off the background
}
if(%CameraPointX > %this.MaxX)
{
%CameraPointX = %this.MaxX;
}
sceneWindow2D.setCurrentCameraPosition(%CameraPointX* 0.5, 0);
// the * 0.5 makes the camera move a little smoother
// it also makes the camera move only %50 so if you where to add this code to a platformer delete the 0.5
}About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
Thanks
10/16/2009 (1:21 am)
Dude, you did not answer my question AGAIN. So Im asking right now, please do not respond to nay more of my threads, you are very unhelpful.Thanks
#3
if thats not an answer, then i dont know what that is...
10/16/2009 (2:07 am)
im gonna quote myself here... cuz you really dont know how to read.Quote:
what he's doing there, its just moving the camera to a certain position, but there's no transition or something like that... the movement is instantaneous... the docs says that, and if you take the time to actually try the code and see how it works, then you SHOULD notice it yourself.
(but, since hes doing that into an onUpdate call, it can give you the feeling the camera is actually moving... is just that the form he's using its innefective... and can fail if the appropiate parameters are not updated properly... and theres a command that can do that with a couple parameters... but since tuts are a better source of learning than the docs....)
if thats not an answer, then i dont know what that is...
#4
10/16/2009 (2:09 am)
and yeah... i'm better off not reading your posts... problem is, half of the board messages are yours ... kinda hard to avoid them.
#5
10/16/2009 (3:22 am)
Thanks man I appreciate that, good luck helping others.
Torque Owner Ehrlich
what he's doing there, its just moving the camera to a certain position, but there's no transition or something like that... the movement is instantaneous... the docs says that, and if you take the time to actually try the code and see how it works, then you SHOULD notice it yourself.
(but, since hes doing that into an onUpdate call, it can give you the feeling the camera is actually moving... is just that the form he's using its innefective... and can fail if the appropiate parameters are not updated properly... and theres a command that can do that with a couple parameters... but since tuts are a better source of learning than the docs....)
dude, really, please, im begging you, READ THE DOCS! try to understand them, code things lil by lil by yourself (i think its time for you to stop "reading" tuts, and code yourself soemthing on your own), see how things work, AND THEN, if something doesnt really work as expected or something, come to the forums and ask for help...
what you're doing is wasting a lot of ppls time, and burning them out (trust me, im really trying to be polite here... i wanted to say it with as many curse words as possible, but i shouldnt). im burned out, there are others that are burned out, and trust me, if you keep this up, by december or so, NO ONE will want to help you.