Help

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Help

Post by N00b »

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!
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Post by link »

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
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Post by N00b »

can you give me a code example?
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Post by link »

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
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Post by N00b »

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?
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

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
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Post by link »

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
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

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.)
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Post by N00b »

this is one om my codes
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
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

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.
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Post by N00b »

But how can i make it so it go all the way on the screen!?
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

think about it
LordCthulu
Posts: 11
Joined: Thu Dec 29, 2005 12:32 am

Post by LordCthulu »

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.
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Post by link »

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
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

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.
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

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.
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Post by N00b »

think about it
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!
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

if missilefiring then
--do animation
end
N00b
Posts: 9
Joined: Sat Dec 24, 2005 4:49 am

Post by N00b »

okay lets try this again
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...
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

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
youresam
Posts: 87
Joined: Sun Nov 06, 2005 1:43 am

Post by youresam »

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?
Post Reply