-- movetest.lua by Geo Massar
function move()
local limit = 11 -- adjust the count limit as needed
local pad = Controls.read()
if (pad ~= oldpad) or (countpads > limit) then
if pad:right() then
playerPos = playerPos + 1
if playerPos > 13 then playerPos = 13 end
end
if pad:left() then
playerPos = playerPos - 1
if playerPos < 1 then playerPos = 1 end
end
if pad == oldpad then
countpads = limit - 2 -- for repeatedly advanced
else
countpads = 0 -- for the first pressed
end
oldpad = pad
else -- do nothing for a moment
countpads = countpads + 1
end
end
player = Image.load "player.png"
playerPos = 1
countpads = 0
while true do
screen:clear()
move()
screen:blit(32*playerPos, 120, player)
screen.waitVblankStart()
screen:flip()
end
I borrowed smiley icon from cynuber's Lsokoban. The test had met my satisfaction on both LP for Win and PSP. I set the count limit to 11 so that the duration of the first pressed key is about 200 ms, long enough to release the key without a repeat. And, the repeat rate while holding the key down is about 20 steps per second.
I am aware of the player being jumpy when moving in the same direction. Shortening steps would make the motion appearing smoother. The entire program would have to be overhauled for the smoother motion. It is a big job, not "a little bit of work". :)
what about an variable that automatically adusts itself according to the distance (movement speed of the character) (high sistance, as in ur case, low updates, small distance, fasterupdates.. (value*-1))
i know its always easier to say: "just change this to that"
or my favourite one, which my boss told me once...
"just add a little checkboxes here and there, so i can controll all those things"
.oO(you know how much work CAN be behind a checkbox...)
greets
Lumo
"Good artists copy, great artists steal." Pablo Picasso go2lumo.com