| View previous topic :: View next topic |
| Author |
Message |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Sun Jan 01, 2006 6:27 am Post subject: Help |
|
|
How can I do so when I press R the main char fires a missile from the x/y position of the char and if you press it again it fires another one!?
Sry for my bad eng! |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Jan 01, 2006 6:42 am Post subject: |
|
|
you make it a function. _________________ 00100000 01101001 01101101 00100000 01110010 01101001 01100111 01101000 01110100 00100000 01100010 01100101 01101000 01101001 01101110 01100100 00100000 01111001 01101111 01110101 00100001 |
|
| Back to top |
|
 |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Sun Jan 01, 2006 7:44 am Post subject: |
|
|
| can you give me a code example? |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Jan 01, 2006 7:55 am Post subject: |
|
|
you should try and make it happen your self. that is the best way to learn. look at other lua codes that use this missle firing or any other projectiles and learn off of that. _________________ 00100000 01101001 01101101 00100000 01110010 01101001 01100111 01101000 01110100 00100000 01100010 01100101 01101000 01101001 01101110 01100100 00100000 01111001 01101111 01110101 00100001 |
|
| Back to top |
|
 |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Sun Jan 01, 2006 8:32 am Post subject: |
|
|
I have tryed many diffrent ways of doing this but I havent succseed. Thats why im asking for help on this forum!
i cant find any game using that type of missile function got any tips about any? |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Sun Jan 01, 2006 1:24 pm Post subject: |
|
|
How about the idea...
You first write a code the best you can. Show it here on this thread. We can take a look at it what is missing or wrong. We'll try to suggest some corrections. This way we all can help you while you are learning, Ok?
PS Don't mind your English. Most of us aren't that good in English, anyway. _________________ Geo Massar
Retired Engineer |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Jan 01, 2006 2:02 pm Post subject: |
|
|
| KawaGeo wrote: | How about the idea...
PS Don't mind your English. Most of us aren't that good in English, anyway. |
Yeah I noticed that too. But that is a good idea. _________________ 00100000 01101001 01101101 00100000 01110010 01101001 01100111 01101000 01110100 00100000 01100010 01100101 01101000 01101001 01101110 01100100 00100000 01111001 01101111 01110101 00100001 |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Sun Jan 01, 2006 7:30 pm Post subject: |
|
|
The Controller has two types of actions triggered. Button Down. and Button up.
Button down is triggered each time the loop goes through and checks for commans. So as long as you have button down. Each time it loops it will trigger a ButtonDown event placed in your code. To fix this. Refer to this forum http://forums.ps2dev.org/viewtopic.php?t=4458
Or create yourself a button inhibitor. Please note that if you do choose to use the code posted on the forum that you must adhere to my request. (That mention my name somewhere in the source code.) |
|
| Back to top |
|
 |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Mon Jan 02, 2006 6:24 am Post subject: |
|
|
this is one om my codes
| Quote: | x=0
y=0
z=1
xm=1
ym=1
function missile(xm,ym,z) if z==1 then screen:blit(xm,ym+ypointchar,missile) end end
function char(x,y,z) if z==1 thne screen:blit(x,y,z,char) end end
while true do
pad = controles.read()
char(x,y,z)
ypointchar=y
if pad:r() then missile(xm,ym,z) xm=xm+5 end
end |
|
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Mon Jan 02, 2006 8:05 am Post subject: |
|
|
The function.
if pad:r() then
missile(xm,ym,z)
xm=xm+5
end
Will be called every time it loops through IE Multiple button presses.
Please refer to what I posted earlier.
pad:r() is called every time the button is down during the check. So multiple events of it will be called each time that value returns true..
So in a loop pad:r() is triggered each time the loop you created. A loop is approx 0.005 MS depending on you code it varies from .0005 to .5ms. Which means you must make an inhibitor (ie a stop variable) so that value event isnt triggered every time it loops through.
Thinking logically helps alot while LUA Programming. |
|
| Back to top |
|
 |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Wed Jan 04, 2006 9:41 am Post subject: |
|
|
| But how can i make it so it go all the way on the screen!? |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Wed Jan 04, 2006 9:51 am Post subject: |
|
|
| think about it |
|
| Back to top |
|
 |
LordCthulu
Joined: 29 Dec 2005 Posts: 11
|
Posted: Thu Jan 05, 2006 2:33 am Post subject: |
|
|
Sorry if this is off-topic, but is there an easy way to get multiple animations to loop at the same time?
Like lets say I want grass "swaying" in the wind, and also want my character on screen to move. |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Thu Jan 05, 2006 7:33 am Post subject: |
|
|
| LordCthulu wrote: | Sorry if this is off-topic, but is there an easy way to get multiple animations to loop at the same time?
Like lets say I want grass "swaying" in the wind, and also want my character on screen to move. |
sometimes it works but sometimes it doesnt. mine is about 50, 50 chance of it going off the character or item so i get a bunch of black boxes looping with multiple animations in them. _________________ 00100000 01101001 01101101 00100000 01110010 01101001 01100111 01101000 01110100 00100000 01100010 01100101 01101000 01101001 01101110 01100100 00100000 01111001 01101111 01110101 00100001 |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Thu Jan 05, 2006 7:48 am Post subject: |
|
|
| LordCthulu wrote: | Sorry if this is off-topic, but is there an easy way to get multiple animations to loop at the same time?
Like lets say I want grass "swaying" in the wind, and also want my character on screen to move. |
3-5 images of grass placed differenly... loop though and poof done... all of the images should be timed and set down. |
|
| Back to top |
|
 |
mrn
Joined: 02 Nov 2005 Posts: 116
|
Posted: Thu Jan 05, 2006 8:09 am Post subject: |
|
|
regarding multiple animations..
if i am not wrong, there is a routine called bench in the "Tools" directory of the LuaOS, which throws bubbles into the air. 50-60 bubbles at the same time.
another source of the same thing could be the page of the twin-tail guy, ema. |
|
| Back to top |
|
 |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Fri Jan 06, 2006 1:34 am Post subject: |
|
|
Yeah... I tryed that and it dident work!
I dont know how to cal a loop I have tryde but I canīt figer it out! |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Fri Jan 06, 2006 7:06 am Post subject: |
|
|
if missilefiring then
--do animation
end |
|
| Back to top |
|
 |
N00b
Joined: 24 Dec 2005 Posts: 9
|
Posted: Wed Jan 11, 2006 11:02 am Post subject: |
|
|
okay lets try this again
| Quote: |
u = 0
if pad:r() then U = 1 end
if U > 1 then
Missa=Missa+5
if Missa > 100 then
Missa=Missa+5
end
|
this script dosent work as I want it to... I want when you press R the Missa is going to go over the whole screen... |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Wed Jan 11, 2006 11:52 am Post subject: |
|
|
Ok, Mr. Noob
Two errors are found:
1) All letters in Lua are case sensitive. That means, u = 0 and U = 0 are different.
2) Every if statement must end with "end" word.
Make those corrections and try.
Keep up going and you'd be fine.
PS: Use [ code] and [/code] for all codes.
PSS: You, other guys, don't crack a smile. _________________ Geo Massar
Retired Engineer |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Tue Jan 17, 2006 1:49 am Post subject: |
|
|
| mrn wrote: | regarding multiple animations..
if i am not wrong, there is a routine called bench in the "Tools" directory of the LuaOS, which throws bubbles into the air. 50-60 bubbles at the same time.
another source of the same thing could be the page of the twin-tail guy, ema. |
No, I didn't put that benchmark test in there, mostly becasue it was just blitting images.. I think the source just said to blit images at random locations, not sure exactly how it works, looks like a table is used.
Anyway, all I put was HSV and TwinTail.
And to n00b, are you monster365? |
|
| Back to top |
|
 |
|