0
\$\begingroup\$

I'm making a game similar in concept (physics-wise) to "asteroids" where a spaceship moves around on a screen from left to right, shooting stuff.

The problem is I have no idea how to set a height limit for my player so it doesn't outfly the parallax background. I've tried a kinematic body 2D that moves left and right with the player so it can't outrun it but the player is pushing it upwards when I test it.

What should I do in such a scenario?

\$\endgroup\$
2
  • \$\begingroup\$ How do you want your height limit? Like hitting an invisible wall? Warping the player to the other side of the screen? \$\endgroup\$
    – Zibelas
    Commented Apr 1, 2023 at 17:50
  • 1
    \$\begingroup\$ Asteroids wrapped around, so you could fly infinitely far in any direction. You could do the same by making your background extend indefinitely. If you don't want that, what should happen instead when the player reaches the vertical limit? Stop dead? Slide? Slow down or gradually turn to the side? Forced U-turn like in Starfox 64? Something else? \$\endgroup\$
    – DMGregory
    Commented Apr 1, 2023 at 17:50

1 Answer 1

0
\$\begingroup\$

I was an idiot 2 days ago, it was in fact simple (I am a beginner in GDscript though) I just needed to use position.y, checking if the player had hit the ceiling or the floor, sorry if I wasted anyone's time.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ Everyone is learning. And there are more beginners than you. You can help them if you explain in a bit more detail what you learnt and how you solved it (for example with some code). There is no reason to feel sorry, everyone started at one point \$\endgroup\$
    – Zibelas
    Commented Apr 4, 2023 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .