forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Player Motion Test

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Mon Sep 19, 2005 6:08 am    Post subject: Player Motion Test Reply with quote

I had experimented some codes for player motion. Here is the final version as of today ...
Code:
-- 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.

Try the code and let me know.

Thanks.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Mon Sep 19, 2005 11:26 pm    Post subject: Reply with quote

hmm hard to say... maybe you should mod it a bit... lower the steps, so you see if the movement is still smooth with this amount of 'lag'

lumo
nore: player beams from field to field here... .oO(star trek *lol*)
_________________
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Back to top
View user's profile Send private message Visit poster's website
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Tue Sep 20, 2005 2:21 am    Post subject: Reply with quote

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". :)

Anyway, thanks for the suggestion.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Tue Sep 20, 2005 2:31 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
chaos



Joined: 10 Apr 2005
Posts: 135

PostPosted: Tue Sep 20, 2005 3:39 am    Post subject: Reply with quote

"just add a little checkboxes here and there, so i can controll all those things"

ouch..
_________________
Chaosmachine Studios: High Quality Homebrew.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Sep 21, 2005 5:41 am    Post subject: Reply with quote

Huh, huh? English, please.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group