Need help on LuaPlayerHMv2 final beta with analog

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Pihas
Posts: 53
Joined: Sat Oct 25, 2008 10:26 pm
Location: Lithuania
Contact:

Need help on LuaPlayerHMv2 final beta with analog

Post by Pihas »

hi, all i'm not new at programing in lua language but having problems on LuaPlayerHMv2 final beta can't uderstand how to use analog on this version, i tried a lot of different ways, but it doesn't work :/ , i too tried to convert old scripts to new one but same broblems...

Thats my project, so i converted bigest part of scripts to new lua player engine but having problems with mouse :(

That's on what i'm working:
Image
(Don't follow link on image it's lithuanian website...)

Code: Select all

red = Color.new(255,0,0,0)
black = Color.new(0,0,0,0)
white = Color.new(255,255,255,255)

--creates player
player = Image.createEmpty(32,32)

player:clear(Color.new(255,0,0,0))

--Players table
Player = { x = 100, y = 100, img = player }

--functiion for analog movement
function analogMove()

pad = Controls.read()

anaX = pad:analogX()
anaY = pad:analogY()

-- anaX and anaY represents number from -128 to 127
-- number "50" is analog deadzone
if anaX > 50 then
Player.x = Player.x + 5
end

if anaX < -50 then
Player.x = Player.x - 5
end

if anaY > 50 then
Player.y = Player.y + 5
end

if anaY < -50 then
Player.y = Player.y - 5
end
end

while true do

screen.clear&#40;Color.new&#40;0,0,0,0&#41;&#41;

Image.blit&#40;Player.x,Player.y,Player.img&#41;   <-- Here is my problem  &#58;cry&#58; 

analogMove&#40;&#41;

-- prints X and Y analog coordinates
screen.print&#40;5,5,"analogX&#58; " .. anaX,12, white, white&#41;
screen.print&#40;5,15,"analogY&#58; " .. anaY,12, white, white&#41;

if pad&#58;cross&#40;&#41; then
break
end

screen.flipscreen&#40;&#41;
screen.waitVblankStart&#40;&#41;
end
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

You'd be better asking on the LuaPlayerHM forum: http://luaplayerhm.xtreemhost.com/forum/
homemister
Posts: 25
Joined: Mon Mar 24, 2008 12:16 pm

Post by homemister »

It has been fixed on the LPHM forums.
Thx IWN for helping him.
kind regards
Homemister
Post Reply