Problem with Sidescroller like R-Type

Posted By: Schmerzmittel

Problem with Sidescroller like R-Type - 12/03/13 10:01

Hello everyone,

i have a strange problem and i don't know what to do.
If you look on YouTube the videos of R-Type longplay, than you see, that the Level moves from right to left. Sometimes it move up or down. The Player can move his ship in every direction and can fire.

The ship itself is not the problem. I have the problem, that i cant get to work, that the level moves and the player can move his ship like that R-Type ship.

I've tryed to move the levelentitys, but if you collide with it, then it stops and the parts that don't get hit by your ship moves without the other parts (modular levelbuild).
Otherwise, if i move the ship with a constant value on the x axis, then the collissiondetection don't work properly.

Can someone give me a hint how i can realise that movement of level (models) and the camera and the ship.

Greetings
Schmerzmittel
Posted By: gri

Re: Problem with Sidescroller like R-Type - 12/03/13 10:23

hi,

you move the whole level ?

why not moving the camera with an threadmilling system. So your collision detection would work independend how crazy the camview is shacking.
Posted By: Schmerzmittel

Re: Problem with Sidescroller like R-Type - 12/03/13 10:49

What's a threadmilling system?

I have tryed to move the camera only with the x axis. Or do you mean the camera should move along a curve(Path)?

When the camera is moving, how can i get to work, that the ship moving with the camera, but can fly in every direction without loss of speed? (f.e. the camera moves to the right, but when the ship moves to the left, it get very slow) The the next problem is, i can't set the "fly area" to the screen size.

I realize that i have nothing done with gamestudio for a long time. How can i forgot everything? It's sad but true.
Posted By: sivan

Re: Problem with Sidescroller like R-Type - 12/03/13 10:54

you can set the camera to simply follow the ship movement in x or xy or whatever direction(s).
Posted By: Schmerzmittel

Re: Problem with Sidescroller like R-Type - 12/03/13 12:19

I know. It's hard to explain in english... crazy

If the camera follows the ship or the ship the camera, then the ship is only in the middle of the screen. But it should be possible to fly to the right, left, up, and down side of the screen. The camera should follow the level (or path or whatever).

Look here: http://www.youtube.com/watch?v=9Br8nOkLkHU

In that way i will make it. But after 5 hours of trial and error, i don't get it.

Today i get an idea. I'll try it the next days. Hope it works. How can such a old thing be so hard?
Posted By: sivan

Re: Problem with Sidescroller like R-Type - 12/03/13 12:39

the camera has a minimum speed pointing to the right, probably x, and it is set as a min x speed of the player model. the player model can move within a determined window size freely by adding/substracting speed values due to user input. nothing magic laugh
Posted By: gri

Re: Problem with Sidescroller like R-Type - 12/03/13 13:57


ups sorry.....Treadmill whithout "h".

You could find some info and example in AUM online

search for "Treadmill".
Posted By: rayp

Re: Problem with Sidescroller like R-Type - 12/03/13 14:41

Quote:
How can such a old thing be so hard?
Because nobody moves the whole level, thats why its so hard ^^

I would use the way pointed out by sivan's last post.
Posted By: Schmerzmittel

Re: Problem with Sidescroller like R-Type - 12/03/13 15:31

Thats right. I thinked about it. And now i have some ideas. It's not that hard. Most of my time get hard things work and easy ones not.

So thanks to all. I'll try it out and hope it works.
Posted By: rayp

Re: Problem with Sidescroller like R-Type - 12/03/13 15:48

Quote:
Most of my time get hard things work and easy ones not
This is true yes, same for me ^^

[ g e r m a n ]
Man darf nicht den Fehler machen und sagen "Ich mache mal SCHNELL..." dann dauerts immer ewig grin
[/ g e r m a n ]
Posted By: Schmerzmittel

Re: Problem with Sidescroller like R-Type - 12/04/13 11:44

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.
Posted By: EpsiloN

Re: Problem with Sidescroller like R-Type - 12/04/13 11:50

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)
© 2023 lite-C Forums