Hi there..
okay: i wanted to try to make a car game...
the problem is not really the programming, i'm not much into math anymore
(a long time ago, in a galaxy far far away...)
i want that if i press the UP key it should drive UP..
and if i press LEFT OR RIGHT it should make an circle...
my script is:
global xAlt
global yAlt
global pSpr
global pAngle
on beginsprite me
pSpr = sprite(me.spritenum)
pAngle = 0
xAlt= sprite(me. spritenum).locH
yAlt= sprite(me. spritenum).locV
end
on enterframe me
--down
if keypressed (125) then
pSpr.locV = pSpr.locV + 5
end if
--up
if keypressed (126) then
pSpr.locv = pSpr.locV - 5
end if
--left
if keypressed (123) then
winkelneu()
pSpr.locH = pSpr.locH - 5
end if
--right
winkelneu()
if keypressed (124) then
pSpr.locH = pSpr.locH + 5
end if
pSpr.rotation = pAngle
end
on winkelneu
pAngle = atan(pSpr.locH-xAlt, pSpr.locV-yAlt)/PI*-180
end
and its turning around like a drunken sailor...
can anyone help me???
thanks a lot..
joergi





Lesezeichen