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
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,086 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Problem with Sidescroller like R-Type [Re: rayp] #433678
12/04/13 11:44
12/04/13 11:44
Joined: Aug 2005
Posts: 512
Bayern
Schmerzmittel Offline OP
User
Schmerzmittel  Offline OP
User

Joined: Aug 2005
Posts: 512
Bayern
Stimmt wohl. Ich denke dann meistens auch in die komplett falsche Richtung. Also zu kompliziert statt einfach. Naja. Mal schauen ob ich was zusammenschustern kann.

Hier nochmal auf Deutsch, weil mein english gaaanz schlecht ist:
Gedanklich habe ich folgendes: Kamera auf Pfad oder mit normalen X - Y Anweisungen bewegen. Schiff ebenso (leichter Vorschub). Beide voneinander getrennt, also nichts mit camera.pan = player.x oder sowas.

Das einzige was ich noch nicht herausgefunden habe ist, wie ich die Bewegung zu den Seiten so begrenzen kann, dass man nicht aus dem Bildschirm fliegt. Ich denk ich komm schon noch drauf.


A7 Com V7.80
Re: Problem with Sidescroller like R-Type [Re: Schmerzmittel] #433679
12/04/13 11:50
12/04/13 11:50
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
Google translator could be wrong laugh but from what I've understood , you need something like this:

ship_max_x = camera.x + 300;
ship_min_x = camera.x - 300;
if(ship.x > ship_max_x) { ship.x = ship_max_x; }
if(ship.x < ship_min_x) { ship.x = ship_min_x; }

Thats assuming camera and ship move on +X axis(forward)
Tweak "300" to get the maximum X your ship can move to the right.

*EDIT* Ship_max and min_x have to be calculated every frame, this way, when you move the camera, the max and min change too, to keep your ship within view.
If you leave your ship (not moving) it'll still stay on screen at the ship_min_x coordinate.

You can do the same for Y.

PS.: You can make it scalable to include a zooming and still get the same results. You just wont use a fixed number but variables, scaling around the Y axis of the camera. (Or Z axis, dunno wich one is towards your ship)

Last edited by EpsiloN; 12/04/13 11:53.

Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Page 2 of 2 1 2

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