Help with background view

Talk about making games.

Help with background view

Postby ShingingDB » Mon Apr 02, 2007 11:11 pm

In my game I have a Status Bar, which is at the very bottom of the view screen. But layered at the very top.
I have my Platform which is layered under the Status Bar, my player, and at the very last layer, is my background. I also have centerView that follows my character. Whenever I put the background's parent as view, the background always appear over the platform. But if I try to change the Z Depth of view, the platform will be over the status bar. Is there a way where I can stop the background from appearing over the platform the moment I change their parent to view?
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 12:11 am

Instead change the parent, change the position of the background based on the view position.

In the 'Draw Actor' event of the background actor, put:

Code: Select all
x = view.x;
y = view.y;


May be, you can take some ideas from here:
http://game-editor.com/forum/viewtopic. ... ght=weight
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 1:47 am

Thanks DUDE!!! + RIGHT THERE
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 2:21 am

It does work, but theres a slight problem. It moves the background to the top left of screen...

How do I fix it?
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 2:24 am

Try this:

Code: Select all
x = view.x + view.width/2.0;
y = view.y + view.height/2.0;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 3:03 am

Thanks again. But there is still a problem. It doesnt show up where I want it to show up. Also it doesn't follow the view....

I wonder if i can + you again?

Edit: Cool I can.
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 3:27 am

ShingingDB wrote:It doesnt show up where I want it to show up.


Add, or subtract, some values in the equations!

Also it doesn't follow the view....


Make sure add the code in the 'Draw Actor' event.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 7:03 pm

Yea it is in draw event.
Draw actor -> Script Editor

Ok I moved it to where I want it to be, but it still doesnt follow the view....
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 7:25 pm

Please, post the game (ged and data directory)
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 7:51 pm

http://rapidshare.com/files/24184258/cMS.zip.html

Uhhh... There was two .ged files and I didn't knwo which was which. So I put both of them in there.
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 8:01 pm

I haven't download the file yet, but if the view is child of some other actor, the x and y coordinates will be relative to the parent.

So, you can use the xscreen and yscreen variables instead.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 8:02 pm

Yea. View is a child of centerView.

So... what do I do?
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 8:38 pm

Use te screen coordinates:

Code: Select all
xscreen = view.xscreen + view.width/2.0;
yscreen = view.yscreen + view.height/2.0;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ShingingDB » Tue Apr 03, 2007 9:10 pm

Thanks dude. I fixed it :D

But now I have another problem. My walls lol.... When my player walks near the edge of the platform my view goes past the wall. I want my view to stop at the wall.

I was using this post, http://game-editor.com/forum/viewtopic. ... ight=walls

Same problem as the first poster. I created my invisible wall using filled wall and a collision event to walk to the wall and it'll stop my player. But the view still goes pass the wall and I dont like that. Novice in that thread said to use a collision event with the view and the wall, but it doesnt work. How do I fix that?
ShingingDB
 
Posts: 43
Joined: Sun Apr 01, 2007 1:31 am
Score: 0 Give a positive score

Postby makslane » Tue Apr 03, 2007 9:20 pm

You can put a collision event in the centerView actor.
How you move the centerView?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron