-
well you can say "if oldpad~=pad then" and then your code there. Where you add "oldpad=pad" at the end of your controlcheck part. What it does is check if your controls are the same as the last one and if so then it doesn't do anything. If they are different then it reads the controls. If it isnt clear i can post some code.
You can also put some WaitVBlank's after it. Then it has a pause and goes slower.
-
The Vblanks work. Thanks alot!
-
line 201 is trhe first one
-
np!
@Soadnation
Where you have "image" you have to write the name of YOUR image. So if its background it becomes "background:pixel(x,y ,)". Or if you want it of the whole screen its "screen:pixel(x,y)".
-
thanks that helped alot. now i got the collision working*when it collides it says somtyhing) just have to change that to do somthing when they colide
-
How would I make it do a different thing if X is pressed if it already does something else?
at the moment I have X shooting
pad = Controls.read()
if pad:cross() then
shoot()
end
*some more code to make sprite change*
then after
newpad = Controls.read()
if newpad:cross() then
*something else*
end
but when I press cross through newpad it still shoots...
end
-
Hmm never tried that. Maybe you can just make a variable for that like:
pad = Controls.read()
if pad:cross() then
whatever=1
shoot()
end
*some more code to make sprite change*
then after
if pad:cross() and whatever==1 then
*something else*
end
The thing is you should have a puase in between i think, because otherwise it will do it immediately afterwards.
-
Ok I done it now.
if pad:cross() and spritenum==sprites then
shoot()
end
if pad:cross() and spritenum==carnum and direction=="up" then
spritey = spritey - 5
end
-
-
Yeah... thanks for the help but just after posting I realised I could do it this way
Oh and if anyone knows how to do this, help would be really appreciated! I've been trying for so long to get it working...
I'm trying to get the lua script to read from a text file (map.txt) and have the numbers or letters which are in map.txt assigned to a table in my script.
So if i had
Tile = {}
Tile[1] = Image.load("grass.png")
and had "G" in the map.txt so that if I put
GGGGGG
GGGGGG
It would do 2 lines of the same image repeated...
thanks if anyone can help.
edit: Could somebody maybe upload an lua script which only has the code and map?