Shoot em up smooth player movement code?

Blitz3D Forums/Blitz3D Programming/Shoot em up smooth player movement code?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

You could look into using sin/cos to produce that deired effect. Build up the angle to 90 to full movement, then when no direction key/button is pressed slow decrease the angle parameter of sin to 0.

[code]

if keydown(LEFT) then
if angle < 90 then
angle = angle + 1
end if
else if keydown(RIGHT) then
If angle > -90 then
angle = angle - 1
end if
else
if angle > 0 then
angle = angle - 1
if angle < 0 then
angle = 0
end if
elseif angle < 0 then
angle = angle + 1
if angle > 0 then
angle = 0
end if
end if
end if

move ship sin(angle),0

[\code]

stick that in your loop. Some of that code isn't fully blitz, but you get the jist of it :o). The sin(angle) part is the movement part, with the effect you mentioned.


Sorry i'm in a rush, need to run!