Page 1 of 1

Camera help needed.

PostPosted: Sat Jul 03, 2010 2:59 pm
by NevenResnik
Hey. I have a background (lawn in this case) that is larger than the camera, so that the player moves around it with arrowkeys. Now I need help with the scripts which will forbid the view actor to move out of the field, and therefor expose the blank background. Any help would be appreciated.

Re: Camera help needed.

PostPosted: Sat Jul 03, 2010 3:03 pm
by Hblade
Find out the image width and height
Then find out the image X and y

When moving the view, only have hit move when its greater than or equal to the images x and y, then when it reaches the images width or height, width-view_width and height-view_height, it simply doesnt move :D Use a variable or something to determan that.

I could get into full detail if you'd like :o

Re: Camera help needed.

PostPosted: Sat Jul 03, 2010 4:17 pm
by NevenResnik
Well, I did try, but obviously did something wrong, since it isn't working. Could you please get 'in more detail'?

Thanks! :P

Re: Camera help needed.

PostPosted: Sat Jul 03, 2010 4:42 pm
by Hblade
k, but I'll make a video showing how :D

Re: Camera help needed.

PostPosted: Sat Jul 03, 2010 4:55 pm
by Bee-Ant
All you need to do is to define the left most, top most, right most and the bottom most coordinates of the Background into variables.

view->DrawActor->ScriptEditor:
Code: Select all
int Left=<your left most x coordinate value here>;
int Top=<your up most y coordinate value here>;
int Right=<your right most x coordinate value here>;
int Bottom=<your bottom most y coordinate value here>;
x=max(Left,min(x,Right-width)); //limit the x movement
y=max(Top,min(y,Bottom-height)); //limit the y movement