camera boundaries and setting limits. help please
Icebox
Member Posts: 1,485
hello guys , i have a platformer game, i have a camera control behavior on an actor that is constrained to the player actor, my scene size is 5000 in width , I want to split this scene into seperate areas.
I want area one width to be 1500 , area two 1500 , area three 2000. So its like having three different scenes but in one. Now the problem is , the control camera would never constrain it self to these areas , it will show what is beyond the area , so if i reach point 1480 it will show up to 1600 , but i dont want that , i want it to show only up to 1500 and end the camera limits there.
Is there a way to do this ? This would make it much smoother on the loading time instead of having four different scenes for one level.
Comments
You would probably have to put the control camera on a seperate, invisible actor that is constrained to the x,y of your main actor.
Make two game attributes that keep track of the actors x,y.
If the control camera actor has a rule that says "If x > 1000, then constrain that actor to 1000." It depends on your screen width. If you use a res of say 500x400, then you'd want the constrain to happen at least a full screen width away from the border of the level, which would be 500.
If your level is 1500 in width, then you would have to make two rules with this behavior. A rule for anything less than the 500 mark, which would mean the camera constrains at 500 while yoru character moves around in the x area of 0-500, and the same for 1000-1500.
Set a rule for between 501 and 999, where if that is true, then that is when your invisible actor constrains itself to the main actor.
The are more dynamic ways to do this that others might suggest.
You could probably do something in a single rule, using the "else" part of it to constrain to the main actor.
This is very possible. Demo incoming in a few minutes.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Franto I am trying to do it the way you said but I kinda messed up but i learned few things from that , thanks aloot !
@Armelline Thank you !
Here's a demo. It splits the scene into three levels that you can visit by pressing the buttons at the top. You must select a level before you can move. It'll prevent the player or the camera moving out of the "level". There's no "level over" condition, just use the buttons to move between levels. If there's interest I might make some additions so level sizes could be defined by a table, and maybe a video tutorial. But I'm feeling lazy.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Your demos are better than some people's finished games ! Seriously !
@Armelline This is amazing , Im sure I would never be able to figure this out by myself !! I really appreciate it thanks alot !
@Armelline What Socks said!
@Armelline Hey Armelline I just wanted to thank you again, it took me time to try to apply it to my game , you saved me from the headache of trying to link puzzles into platformer with different scenes , now i can do them in one scene . I learned alot so just wanted to thank you , with this i wont have to worry about load times in a level. here is the result.
@Icebox1910 Glad to help, it looks great!
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Hey sorry but , when I tried both the demo and my game on gs it works good , but on my android device they both dont work , the camera wont move , is this a bug ?
I tested my demo on my iPhone and it worked perfectly, so maybe. I think I remember seeing a bug about Android devices not recognising the device screen width/height attributes, which would indeed break my demo and make this kind of thing pretty much impossible.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support