Theres just something i need to clarify.
If i do a dofile, does my application retain all the variables, arrays etc from the other file?
Printable View
Theres just something i need to clarify.
If i do a dofile, does my application retain all the variables, arrays etc from the other file?
Yes it does.Zitat:
Zitat von Gutya
Thanks mate.
P.S. Haha, just noticed the sig. :D
thanks, I see what I can do.Zitat:
Zitat von califrag
I did. Nobobdy gave any examples lkike that.Zitat:
Zitat von califrag
Nobody has been able to help me.....I am dissapointed in this thread....
Hey, can someone help me with a couple of things?
If someone were to make a game in lua, ex. a fighting game , how would one go on about it. I've read the tutorials provided by whitehawk, they've helped alot but im looking for something a bit more complicated. How would you make it so that when your press a button, such as X, an animation plays?
something like this?
if pad:cross then
screen:blit(30, 120, punchR)
screen.flip()
end
except the character is actually executing the animation so that the location is not needed but it is where the character is, how would I do that, make it so that the character image changes to the animation, at his position? Then back?
Also How would you make your character move at a constant rate when you hold down a button and stop when you release? Would you have a command that if the button is pressed the character moves X amount of pixels right or left ect, depending on the button and then it stops when the button is released? If so, what is the command?
Finally how would you make it so that when an animation is played, if the opposing character is in range (right next to you) that the animation changes from just playing the animation but to another one where the opposing character is hit and his life goes down, an if command? If character is in range, play animation punchedR new line health - 20?
Thanks for your help
Andrey
Edit: One last thing, how would you make that if you have an image (background) and your moving in it, when you reach the end of the screen it keeps moving. Like a long image horizantle that you keep moving through then at the end when you touch a certain object it takes you to the next image, (background/level).
how would you do a sidescrolling screen? such as when your sprite reaches the end of the screen (or the middle) it scrolls with him
I would also like to know EVERYTHING you just said.Zitat:
Zitat von Andrey
I found this in teh internet :PZitat:
Zitat von mannymix03
Code:--load the images
layer = {
buffer = Image.createEmpty(480, 272)
}
slicesize=500
slices = {
Image.load("slice1.png"), --500x272px
Image.load("slice2.png"), --500x272px
Image.load("slice3.png") --500x272px --images are at his site
}
-- 0..1500
shade = {
start=0,
ende=480
}
drawslices = 0
function limited(val)
val = math.ceil(val/501)
if val>table.getn(slices) or val==0 then
return 1
end
return val
end
-- correct this value
while not Controls.read():start() do
shade.ende = shade.ende+1
shade.start = shade.start+1
if shade.ende>=1500 then
shade.ende=0
end
if shade.start>=1500 then
shade.start=0
end
--move the background to left
layer.buffer:clear()
drawslices = slicesize-math.mod(shade.start,slic esize+1)
layer.buffer:blit(0,0,sli ces[limited(shade.start)],math.mod(shade.start,sli cesize+1),0,drawslices,27 2)
layer.buffer:blit(drawsli ces,0,slices[limited(shade.ende)],0,0,math.mod(shade.ende, slicesize+1),272)
layer.buffer:print(25, 100,shade.start ,Color.new(255,0,46))
layer.buffer:print(25, 110,shade.ende ,Color.new(255,0,46))
-- update screen
screen:blit(0,0,layer.buf fer)
screen.flip()
end