Hi, i know somone here posted something about it but i can't find it.A sidescrolling code in lua like PSPsoldier to make someone move . counld somone help plz.
Printable View
Hi, i know somone here posted something about it but i can't find it.A sidescrolling code in lua like PSPsoldier to make someone move . counld somone help plz.
Hey does anyone know of a 'goto' command in lua. Like instead of calling a function, just actually skip to a part of you code without have to go back. Like the lbl and goto functions on a ti-83+ calculator.
hmmm.....mayb you could define a variable then check whether it equals a certain number, when it does equal that number then run the code.Zitat:
Zitat von emericaska8r
On second thought, that might not answer your question. :( Well, I try.Code:duh = 0
if pad:cross() then
duh = duh + 1
end
if duh >= 2 then
duh = 1
end
if duh == 1 then
(insert code here)
end
I'm sorry for the double post, but how would you do that a certain button is held down for 5 seconds or something.
Would it be like that or another way?Code:if pad:cross(180) then
<insert code here>
end
nope another way. You have to use a timer.
And no there isn't a goto command and neither a label command. You have to use functions for this.
Hmm.... After looking throuigh the source, the Image loading is an integer, and it returns 1 on completion i belive, so give it a try.. So put a true or false statement, if the loading of an image is == 1, then it retruned completed, if not, do if not loadd an imgae ==1, then failed to load an image.
that someone suggested looking at the 'music' file bundled with luaplayer. it has a side-scrolling background.Zitat:
Zitat von ZereoX
Ok tkz il look at it tonight cause im at school.
can someone tell we what's wrong with this please?
I tried making a quick game as a joke and It won't work.
I read quick guide and built it around what it said, and whenever I try launching it in luaplayer it says that there is no script file found. I tried saving it as both script.lua and index.lua. any help appreciated.
I wanted to make it so that you had to press the cross button really fast to move the kid over to the "mom" befoe the pimp catches him and shanks him.Code:pimppicture=Image.load("pics/pimp.png")
kidpicture=Image.load("pics/kid.png")
mom=Image.load("pics/mom.png")
background=Image.load("pics/background.png")
winner=Image.load("pics/winner.png")
loser=Image.load("pics/loser.png")
distance=nul
timer=1
pimp=430
kid=300
while true do
timer=1
screen:clear()
pad=Controls.read()
if pad:cross() then
kid=kid-2
end
kid=kid-.5
pimp=pimp-.5
if kid=40 then
while timer=1
pad=Controls.read()
screen:blit(0, 0, winner)
screen.flip()
if pad:cross() then
timer=2
end
end
end
distance=kid+30
if pimp=distance then
while timer=1
pad=Controls.read()
screen.blit(1, 1, loser)
screen.flip()
if pad:cross() then
timer=2
end
end
end
screen.blit(0, 0, background)
screen.blit(0, 100, mom)
screen.blit(kid, 100, kidpicture)
screen.blit(pimp, 100, pimppicture)
screen.flip()
end
Your code is horribly hard for me to read.