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.
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):
moveX.setDLoc(contTilt,0,0,1)
g.addActiveActuator(moveX,1)
if (tilt >-6):
own.tilt -= speed
elif (D.isPositive() and pos[0] <= limit):
moveX.setDLoc(contTilt,0,0,1)
g.addActiveActuator(moveX,1)
if (tilt <6):
own.tilt += speed