Boundaries in a Space Scroller


I apparently don’t get on here very much but, I was wondering if I could get some help. I’m trying to create a scrolling ship game, something along the lines of Raiden.

I have the ship movement down, but I’m having trouble as of right now with the boundaries settings. I want to be able to hold the ship within certain parameters. Here’s my problem, I don’t want to have to rely on collision to keep it there, I want to be able to do this in python.

Any ideas? Even if it is collision settings let me know what you think.

This is my current blend file created thus far in blender 2.43, I know I should upgrade I just haven’t gotten around to it.

You can just make a box or rectangle, take off the top, make it invisible and then your ship cannot move outside of it?

the constraint actuator should do it; set the axis to limit and the boundary values, and you’re good to go.

Try adding this bit of code. Change limit to whatever suits your needs. You could even change limit to a global variable, if you want to change it during gameplay.

pos = own.getPosition()
limit = 15
print pos

if (A.isPositive() and pos[0] >= -limit):
    if (tilt >-6):
        own.tilt -= speed
elif (D.isPositive() and pos[0] <= limit):
    if (tilt <6):
        own.tilt += speed

Thank you all so much for your input! I will try each method and see which one suits me best, again, Thank you!