Submit Your Own Code

PSP Lua CodeBase : Move Player

Description:
A code to move your player along the x and y axis.

-- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Move Player
-- SUBMITTED BY: pjspeedy

-- MADE BY PJSPEEDY --
-- move player --

blue = Color.new(0,0,255) 

player = Image.createEmpty(32,32)
player:clear(blue)

Player = { x = 30, y = 100 }

function movePlayer()
pad = Controls.read()
if pad:right() then
Player.y = Player.y + 5
end
if pad:left() then
Player.y = Player.y - 5
end
if pad:down() then
Player.x = Player.x + 5
end
if pad:up() then
Player.x = Player.x - 5
end
end


while true do 

screen:clear()

movePlayer()

screen:print(50,100,"THIS CODE WAS WRITTEN BY PJSPEEDY!!!", blue)
screen:blit(Player.y,Player.x,player)

screen.waitVblankStart()
screen.flip()
end

Back to CodeBase
 

Please welcome daryy, our newest member.

Who's Online: 3 Guests, 0 Users

Total Members: 556
Total Posts: 13060
Total Topics: 1480
Total Categories: 8
Total Boards: 35

Recent Posts:

Re: Lua 5.1.4 help. by daryy
Re: PGELua Help - need term for a special rotation fix (mathematical issue) by yaustar
Re: Lua Loader? by Buddy4point0
Re: Lua Loader? by osgeld
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl


Copyright © 2006-2007 www.EvilMana.com All rights reserved.
EvilMana Logo by emcp and Charlie