forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Sun Jan 01, 2006 6:27 am    Post subject: Help Reply with quote

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
View user's profile Send private message
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Sun Jan 01, 2006 6:42 am    Post subject: Reply with quote

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
View user's profile Send private message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Sun Jan 01, 2006 7:44 am    Post subject: Reply with quote

can you give me a code example?
Back to top
View user's profile Send private message
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Sun Jan 01, 2006 7:55 am    Post subject: Reply with quote

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
View user's profile Send private message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Sun Jan 01, 2006 8:32 am    Post subject: Reply with quote

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
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun Jan 01, 2006 1:24 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Sun Jan 01, 2006 2:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Sun Jan 01, 2006 7:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Mon Jan 02, 2006 6:24 am    Post subject: Reply with quote

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
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Mon Jan 02, 2006 8:05 am    Post subject: Reply with quote

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
View user's profile Send private message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Wed Jan 04, 2006 9:41 am    Post subject: Reply with quote

But how can i make it so it go all the way on the screen!?
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Wed Jan 04, 2006 9:51 am    Post subject: Reply with quote

think about it
Back to top
View user's profile Send private message
LordCthulu



Joined: 29 Dec 2005
Posts: 11

PostPosted: Thu Jan 05, 2006 2:33 am    Post subject: Reply with quote

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
View user's profile Send private message
link



Joined: 19 Oct 2005
Posts: 61

PostPosted: Thu Jan 05, 2006 7:33 am    Post subject: Reply with quote

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
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Thu Jan 05, 2006 7:48 am    Post subject: Reply with quote

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
View user's profile Send private message
mrn



Joined: 02 Nov 2005
Posts: 116

PostPosted: Thu Jan 05, 2006 8:09 am    Post subject: Reply with quote

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
View user's profile Send private message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Fri Jan 06, 2006 1:34 am    Post subject: Reply with quote

Quote:
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!
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Fri Jan 06, 2006 7:06 am    Post subject: Reply with quote

if missilefiring then
--do animation
end
Back to top
View user's profile Send private message
N00b



Joined: 24 Dec 2005
Posts: 9

PostPosted: Wed Jan 11, 2006 11:02 am    Post subject: Reply with quote

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
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Jan 11, 2006 11:52 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Tue Jan 17, 2006 1:49 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group