Page 1 of 2
Help with background view
Posted:
Mon Apr 02, 2007 11:11 pm
by ShingingDB
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?
Posted:
Tue Apr 03, 2007 12:11 am
by makslane
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
Posted:
Tue Apr 03, 2007 1:47 am
by ShingingDB
Thanks DUDE!!! + RIGHT THERE
Posted:
Tue Apr 03, 2007 2:21 am
by ShingingDB
It does work, but theres a slight problem. It moves the background to the top left of screen...
How do I fix it?
Posted:
Tue Apr 03, 2007 2:24 am
by makslane
Try this:
- Code: Select all
x = view.x + view.width/2.0;
y = view.y + view.height/2.0;
Posted:
Tue Apr 03, 2007 3:03 am
by ShingingDB
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.
Posted:
Tue Apr 03, 2007 3:27 am
by makslane
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.
Posted:
Tue Apr 03, 2007 7:03 pm
by ShingingDB
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....
Posted:
Tue Apr 03, 2007 7:25 pm
by makslane
Please, post the game (ged and data directory)
Posted:
Tue Apr 03, 2007 7:51 pm
by ShingingDB
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.
Posted:
Tue Apr 03, 2007 8:01 pm
by makslane
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.
Posted:
Tue Apr 03, 2007 8:02 pm
by ShingingDB
Yea. View is a child of centerView.
So... what do I do?
Posted:
Tue Apr 03, 2007 8:38 pm
by makslane
Use te screen coordinates:
- Code: Select all
xscreen = view.xscreen + view.width/2.0;
yscreen = view.yscreen + view.height/2.0;
Posted:
Tue Apr 03, 2007 9:10 pm
by ShingingDB
Thanks dude. I fixed it
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?
Posted:
Tue Apr 03, 2007 9:20 pm
by makslane
You can put a collision event in the centerView actor.
How you move the centerView?