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
 

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