Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Side Scrolling Space Shooter #238807
11/30/08 11:43
11/30/08 11:43
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Hey guys I started to code a side scrolling space shooter like Jets'n'Guns if you know the game =O.

And now I've got a problem.

Does anyone know how I manage it that the space ship isn't able to leave the current screen bounderies?

Here a picture to show what I mean.





hope you can help me ~

Roxas~

Last edited by Roxas; 11/30/08 11:44.
Re: Side Scrolling Space Shooter [Re: Roxas] #238811
11/30/08 12:06
11/30/08 12:06
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline
User
Shinobi  Offline
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
try something like this in the ship action ....
for example if camera.y and ship.y dosent work try other directions

if(ship.y < camera.y+300 && key_d ==1){ship.y+=5*time_step;}
if(ship.y > camera.y-300 && key_a ==1){ship.y-=5*time_step;}
if(ship.z < camera.z+500 && key_w ==1){ship.z+=5*time_step;}
if(ship.z > camera.z-500 && key_s ==1){ship.z-=5*time_step;}

this is just a simple example you can easyly shorten up the code for your needs.

Re: Side Scrolling Space Shooter [Re: Shinobi] #238814
11/30/08 12:22
11/30/08 12:22
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
If this is 2D... why not simply:

clamp(ship.x, 0, screen_size.x-ship_size.x);
clamp(ship.y, 0, screen_size.y-ship_size.y);

Last edited by Joozey; 11/30/08 12:23.

Click and join the 3dgs irc community!
Room: #3dgs
Re: Side Scrolling Space Shooter [Re: Joozey] #238817
11/30/08 12:34
11/30/08 12:34
Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
Shinobi Offline
User
Shinobi  Offline
User

Joined: Oct 2003
Posts: 560
Germany / NRW / Essen
There are many solutions to solve this problem , i just wanted to show an easy to understand way wink

Re: Side Scrolling Space Shooter [Re: Shinobi] #238823
11/30/08 13:14
11/30/08 13:14
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
thanks for the quick answers ^^
well i figured something out. its a bit different to shinobi's solution but it helped me for my solution.

so I think it works now. thank you ;]

Roxas.

Re: Side Scrolling Space Shooter [Re: Roxas] #238824
11/30/08 13:32
11/30/08 13:32
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Shinobi: Yeah, that's true smile
Roxas: Good luck smile


Click and join the 3dgs irc community!
Room: #3dgs

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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