Hi I'm new here. I have a question about camera..

Non-platform specific questions.

Hi I'm new here. I have a question about camera..

Postby rp0094 » Sun Jun 22, 2008 4:03 am

Hi. I've learned at least 20% of this program thus far, but am nowhere near having a full grasp on anything 20%, other than some minor basic things.

I noticed parts of the built-in tutorials were slightly bugged. The tutorial for "Having the Camera follow Actor on the Moving Screen", seemed to end with a bug. The cursor seemed to have accidently clicked the wrong Parent, and got the notice for it, but then didn't do anything for about 1 minute, until it said the tutorial ended.

I am just trying to set the camera to follow the main "player" as it moves along the screen.

I've tried making the "Player" the parent of the "View", and then I tried making the "View" the parent of the "Score", but no combination and attempt worked. Everytime I load the game, and I move the character, it just walks off the screen, and the camera apparently doesn't follow it.

Help very much appreciated. Thanks :).

(Also, I am very sure this is possible, but to make sure, you're able to import your own textures, character gifs, etc., right?)
rp0094
 
Posts: 1
Joined: Sun Jun 22, 2008 12:45 am
Score: 0 Give a positive score

Re: Hi I'm new here. I have a question about camera..

Postby DST » Sun Jun 22, 2008 4:48 am

IF you set view to be the child of player, then view must follow player.

If it isn't, then you have some kind of glitch.

Try unparenting the view, and add a draw actor to view:
Code: Select all
x=player1.x-320;


This is for a game that is 640x480, we subtract half the width (because view 0 starts in upper left hand corner of view).
and player1 is what i always call player1; you can call it whatever you like. (i think you said "Player").

I make sure never to use capital letters with names in GE. You will type them many times. Shift is just one more key to press, for no real reason.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Hi I'm new here. I have a question about camera..

Postby Bee-Ant » Sun Jun 22, 2008 7:48 pm

Or use this code for any size of view
Code: Select all
x=player.x-(width/2);
y=player.y-(height/2);
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Hi I'm new here. I have a question about camera..

Postby Fuzzy » Sun Jun 22, 2008 10:04 pm

improve the speed some: make two global variables, called HalfWidth and HalfHeight. in create actor event for view put this:

Code: Select all
HalfWidth = width/2;
HalfHeight = height/2;


and then for Bee-Ants code put these lines instead

Code: Select all
x=player.x-HalfWidth;
y=player.y-HalfHeight;


Why? you only need to do the math once per game instead of every draw event!
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Hi I'm new here. I have a question about camera..

Postby catacomber » Mon Jun 23, 2008 9:21 pm

To answer your question about whether you can import your own gifs etc., yes, although you will have to experiment to see which graphic format works best for you. Some prefer pngs. : )
User avatar
catacomber
 
Posts: 195
Joined: Fri Sep 28, 2007 5:36 pm
Score: 10 Give a positive score

Re: Hi I'm new here. I have a question about camera..

Postby DST » Tue Jun 24, 2008 1:11 am

Interesting that Cat was the only one of us that noticed that question in his post.....
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron