|
Submit Your Own Code
PSP
Lua CodeBase : Chair In/Out Description:
This will allow you to adjust the position of a chair in your game to give the
effect that it has been pushed in or pulled out as long as your character is in the
correct area and position. Its a useless thing as a chair but could easily be
adapted to adjust a lever as opposed to a chair :}
-- EVILMANA.COM PSP LUA CODEBASE
-- www.evilmana.com/tutorials/codebase
-- Chair In/Out
-- SUBMITTED BY: Rich200313
red=Color.new(255,0,0)
-- stop player from leaving screen
screenwidth = 480 - playerup:width() - 10
screenheight = 272 - playerup:width() - 10
-- set the status of the chair (0=out and 1=in)
chair1stat = 0
-- set player position
Player = { }
Player[1] = { x = 200, y = 50 }
while true do
pad = Controls.read()
screen:clear()
-- display background
if room == 1 then
for a = 0, 14 do
for b = 0,8 do
screen:blit(64 * a, 32 * b, floor)
end
end
-- set the chair image to be in or out depending on the
-- 'chair1stat' variable
if chair1stat == 0 then
chair1 = chair1out
end
if chair1stat == in then
chair1 = chair1in
end
-- Then just add some checks such as :
if player[1].x > 20 and player[1].x < 60 and player[1].y > 100 and player[1].y < 140
and pad:cross() and player == playerright and chair1stat == 1 then
chair1stat = 0
end
if player[1].x > 20 and player[1].x < 60 and player[1].y > 100 and player[1].y < 140
and pad:cross() and player == playerright and chair1stat == 0 then
chair1stat = 1
end
Back to CodeBase
|