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

Who's Online:

Total Members: 844
Total Posts: 13009
Total Topics: 1473
Total Categories: 7
Total Boards: 25

Recent Posts:

Re: chek it out i made front page of qj.net by chi-kitory
Re: chek it out i made front page of qj.net by Rick
Re: Hi everyone (remember me? :P) by Tdude_gamer
Re: Hi everyone (remember me? :P) by dan369
Hi everyone (remember me? :P) by Tdude_gamer
Re: Hows everyone doing? by osgeld
Re: Homebrew Idol 3: The Homebrew Horror Show by dan369
Problem on Tag game by andykd7


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