Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Konsti, AndrewAMD, 1 invisible), 1,376 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
screen edge #437013
02/07/14 20:36
02/07/14 20:36
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
Hi, I am looking for information, about how to keep the player with in the screen edge,

at the moment it moves but disappears off screen.

looking through the manual, but cant find anything about it.

Re: screen edge [Re: DuaneDawson] #437031
02/08/14 08:51
02/08/14 08:51
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
move the camera together with player similarly as in workshop 24


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: screen edge [Re: sivan] #437178
02/11/14 13:49
02/11/14 13:49
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
Hi I am trying to create, a top down space shooter, where you control a ship
and the back ground scrolls below you, so the camera would not be fixed, the ship would have free movement with in the screen area, to be fare I could do with as much help advise on how to do this project.

in my understanding of how im going to this is, I have a ship model, that at the moment as the camera set to look down on it, ive some basic control to move the ship, up down left and right.

I was thinking to stop the ship going off screen was to have for blocks that form a square around the ship, that would stay static and be invisible.
then build the level and enemy that scroll towards the player.

but then im thinking this could be a problem as the level and enemy coming towards the player would not beable to pass the block keeping the player within the screen.

what is the best thing to do, is there any kind of tutorial for this kind of project?


cheeers

Re: screen edge [Re: DuaneDawson] #437182
02/11/14 15:17
02/11/14 15:17
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Assuming your player ship is on z = 0, try to calculate the position (or find it by trial and error) that is in the center of the screen with z = 0 (obviously this is camera.xy when camera.tilt = -90). Then simply limit the player movement, for example using clamp, to said position +- some quants in all 4 directions.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: screen edge [Re: Superku] #437185
02/11/14 15:50
02/11/14 15:50
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
ok i know the position of its xyz where its at 0, but what information should i be looking at from the manual to do what you said about limiting the movement?



cheers

Re: screen edge [Re: DuaneDawson] #437187
02/11/14 17:26
02/11/14 17:26
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The easiest way, as already stated, would probably be "clamp".
Example:

player.x += ...
player.x = clamp(player.x,center_pos.x-200,center_pos.x+200);
player.y = clamp(player.y,center_pos.y-300,center_pos.y+300);


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: screen edge [Re: Superku] #437190
02/11/14 19:14
02/11/14 19:14
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
ok thank ill have a play around.

Re: screen edge [Re: DuaneDawson] #437239
02/12/14 18:46
02/12/14 18:46
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
thanks for that everything works great laugh


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1