How are we suppost to help you if we have no idea what you are trying to do?
Printable View
How are we suppost to help you if we have no idea what you are trying to do?
You know, an arrow arcs when shot, a bullet arcs but slowly, stuff like that
what im asking is so that when i shoot my bullet or arrow, it arcs about 3 pixels and rotates a lil every 1/4 a second
Do you know what I mena yet? I have an idea but i doubt itll work:(
Someone know which is the command to create a new file (text file) where i can put a table? :PC:
still no answer for my question? :(
i solved my problem now
Okay hi everyone.
I am making a new game...
This is gonna be my first side scroller.
Now some of my code was from my chao garden
so it might not be all Fancy and neat..
Anyway i need to know how to make my Player
Jump on a barrier or image.
Here's alittle bit of my code. \\//
This isnt all my code but it'a what i have found that help's me.Code:sprite = {}
sprite[1] = Image.load("sprite.png")
sprite[2] = Image.load("sprite2.png")
sprite[3] = Image.load("sprite3.png")
sprite[4] = Image.load("sprite2-2.png")
sprite[5] = Image.load("sprite3-3.png")
sprite[6] = Image.load("sprite-1.png")
sprite[7] = Image.load("sprite4.png")
sprite[8] = Image.load("sprite4-4.png")
Spriteimg=sprite[1]
anim = 1
animTimer = 0
LastDirection = sprite[1]
function duck()
if LastDirection==sprite[1] then Spriteimg=sprite[7]
elseif LastDirection==sprite[6] then Spriteimg=sprite[8] end
end
function walkRight()
LastDirection=sprite[1]
animTimer=animTimer+1
if animTimer>=1 and animTimer<=4 then Spriteimg=sprite[2]
elseif animTimer>=5 and animTimer<=8 then Spriteimg=sprite[3]
end
if animTimer>=9 then animTimer=0 end
end
function walkLeft()
LastDirection=sprite[6]
animTimer=animTimer+1
if animTimer>=1 and animTimer<=4 then Spriteimg=sprite[4]
elseif animTimer>=5 and animTimer<=8 then Spriteimg=sprite[5]
end
if animTimer>=9 then animTimer=0 end
end
while true do
screen:blit(0, 0, Background)
pad = Controls.read()
if pad:right() then walkRight() x=x+3 Spriteimg=Spriteimg
elseif pad:left() then walkLeft() x=x-3 Spriteimg=Spriteimg
elseif pad:up() then walkLeft() y=y+3 Spriteimg=Spriteimg
elseif pad:down() then walkLeft() y=y-3 Spriteimg=Spriteimg
else Spriteimg=LastDirection
end
If anyone's intrested in making GFX or helping for my new project then
please PM me as it's Invite's ONLY.
Thank's :icon_bigg
P.S
I Also have a jumping problem lol.
There's not really a function to create a file, you just tell lua what the file name is and then make it write on it. Here's an example:Zitat:
Zitat von aldebaran
You could prob replace SaveFile for the file's name inCode:SaveFile="save.txt"
function saveTable()
file=io.open(SaveFile,"w")
if file then
file:write("MyTable={")
for index, value in Table do--TABLE WOULD BE THE TABLE'S NAME!
file:write(value..",")--THE VALUE ALONE
end
file:write("}")
file:close()
end
end
Also, I only made it write the index's value in that example, but you can make it write the index too that's all up to you.Code:file=io.open(SaveFile,"w")
So just expirement. :)
I think I understand what you mean by ARCing down. Make the bullet fall on the ground after a while right? Anyway, here's a cheap way you could do it.Zitat:
Zitat von SG57
I'm assuming the bullet's Y is "bulletY", so here goes.
That would be like I said a cheap trick. But then again, I never saw your code and this might not be the best idea. :neutral: On top of that, it might freeze the game and make the bullet stop going forward if its used as a single function. Your best bet would be to create one big function and have the bullet's velocity ,arcing effect and what not into one function.Code:function bulletGravity()
local CurrentY=bulletY
local time=0
time=time+1
if time>=50 then --WHEN THE BULLET START'S DROPPING DOWN
for y=CurrentY,272 do --FROM TRAJECTORY TO BOTTOM OF SCREEN
bulletY=bulletY-0.5
end
end
end
Anyway good luck.
(sorry for the double post.)
Thanks! I'll try it ASAP
Please could someone help?
Sorry on such short notice but i have a small problem....
Well i have made my Sprite's and character's and done all the code for my game BUT, Know my character cant jump properly?
Oh and how can i make barrier's?
Like on mario when you can jump on the ledge above.
I just really need to know how to make barrier's so my player can
hit thing's and stand on them lol.
Thank's in return.