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 anthonyjee, our newest member.

Who's Online:

Total Members: 522
Total Posts: 13085
Total Topics: 1515
Total Categories: 7
Total Boards: 42

Recent Posts:

Re: Hello every body... by DeniseVera
Need help please by Robbynator
Re: Hello every body... by horvathann
Re: background criminal record check by backgroundchecker
background criminal record check by backgroundchecker
Intro to Perl Part 2: What are Scalars? & Examples by Chi Kitory
Intro to Perl Part 1 About Perl and Hello World by Chi Kitory
Re: Trying To Get Rid of the Spammers by Charlie


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