Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; okay grimfate after that huge long collision detection are u saying i do --long collisin thing here then hit = ...
-
11-26-2006, 02:37 AM #4321Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
okay grimfate after that huge long collision detection are u saying i do
--long collisin thing here then
hit = "true"
end
if hit = "true" then
--now would i do what slice4ever said and just blit the demon somewhere really far off the screen like 800, 900 or something? if so i have it so that the demon is chasing something wouldnt it eventually work its way back on to the screen? isnt there someway i can unload it or something or once its blit off the screen can i stop it from following if u need it i can post my source.
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
11-26-2006, 06:47 AM #4322QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
how about do
if dead == false then screen:blit(demon.x,demon .y,demon.img) end
Then make dead become true when collision happens:
if hit == true then dead == true end
Thatll make it stop blitting when it gets hit.
-
11-26-2006, 06:49 AM #4323QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Have the demon keep track of its own health in the table. Check the health before updating, if it is lower then 0, then don't update the AI.
-
11-26-2006, 07:09 AM #4324QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
everytime i press X its just crappy sound and not my full wav. i can hear maybe 0.001 sec from it...whats the prob?Code:bgmenu = Image.load("bg_menu.png") shot = Sound.load("bullet.wav",false) while true do screen:blit(0,0,bgmenu) screen.waitVblankStart() screen.flip() pad = Controls.read() if pad:cross() then shot:play() screen.waitVblankStart(100) dofile("game.lua") break end end
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
11-26-2006, 07:12 AM #4325QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Thatll make X toggle it on and off.Code:bgmenu = Image.load("bg_menu.png") shot = Sound.load("bullet.wav",false) while true do screen:blit(0,0,bgmenu) screen.waitVblankStart() screen.flip() pad = Controls.read() if pad:cross() and play == false then play = true end if pad:cross() and play then play = false end if play then shot:play() end screen.waitVblankStart(100) dofile("game.lua") break end end
-
11-26-2006, 07:17 AM #4326QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
well i found that problem is that my sound is 20kbps ... 64kbps plays ok
edit. yeh problem solved, it must be *.wav file with bitrate 64kbpsGeändert von myschoo (11-26-2006 um 08:11 AM Uhr)
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
11-26-2006, 10:14 AM #4327Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
whats the code for 'if no arrow keys are press then'
-= Double Post =-
i mean, "if the last keypressed was (lastkeypressed) then"Geändert von yoyomacy (11-26-2006 um 10:14 AM Uhr) Grund: Automerged Doublepost

-
11-26-2006, 10:16 AM #4328QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
if pad == nil then blah end
I THINK thats it, try it.
-
11-26-2006, 10:24 AM #4329Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
no i figured it out, its if not pad:right() and not pad:left() then

-
11-26-2006, 10:40 AM #4330QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
But to indicate absolutely NO buttons are being pressed, its if pad == nil
-
11-26-2006, 11:17 AM #4331QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
i want to do, when i touch the object and press X,it will disappear...
i thought about something like this:
this doesnt work, could anyone help?Code:function touchFunction() pad = Controls.read() if object1.y = object2.y and object1.x = object2.x and pad:cross() then object2 == nil end then just while true do functionTouch()
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
11-26-2006, 11:19 AM #4332QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Code:function touchFunction() pad = Controls.read() touch = 1 if object1.y = object2.y and object1.x = object2.x and pad:cross() then touch = 2 end while true do functionTouch if touch == 1 then screen:blit(object2.x,object2.y,object2.img) end
-
11-26-2006, 11:35 AM #4333Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
actually my way worked...
Zitat von -TacticalPaper-

-
11-26-2006, 11:39 AM #4334QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
error: "then" expected near "=" :/
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
11-26-2006, 11:41 AM #4335QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
You forgot to use double == signs. When you compare two things, its ==. When you make something equal to something else, its =. And yes yoyomacy your way works fine, but you originally asked how to tell if no buttons were being pressed.Code:function touchFunction() pad = Controls.read() touch = 1 if object1.y == object2.y and object1.x == object2.x and pad:cross() then touch = 2 end while true do functionTouch if touch == 1 then screen:blit(object2.x,object2.y,object2.img) end
-
11-26-2006, 12:18 PM #4336QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
error: calling "blit" on bad self <number expected got nil>
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
11-26-2006, 03:15 PM #4337Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
i was considering tactial's idea but then i saw ur post. yes i have the demon's health set to a variable. and my musket does 5-10 damage so i set it to math.random(5,10)
Zitat von head_54us
so i would have to combine tacticals post along with yours ok i see i got it now. thanks guysIf you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
11-26-2006, 03:20 PM #4338QJ Gamer Bronze
- Registriert seit
- Jul 2005
- Ort
- USA
- Beiträge
- 496
- Points
- 14.090
- Level
- 77
- Downloads
- 0
- Uploads
- 0
I need to blit the same picture in different spots simultaneously. I have the x/y positions set up in a table. I really am stumped...
Here is an example of what I have.
Code:--Dot positions pos = {} pos[1] = {x=s1,y=f1} pos[2] = {x=s2,y=f1}I need it to blit a picture at pos 5,9, and 14. Can you help me?Code:--Chords maj = {} maj[1] = {name = "C Major", pos = {5,9,14}}
ps. s1/f2 indicate coordinates.
-
11-26-2006, 03:21 PM #4339Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
wow. you ripped that entire code from shines example. and didnt even give credit. (in your "demo" that you released as well). and, you claealt state that its made by you.and you cant even get it to work. sad... if anyone doesnt believe me, download luaplayer, go to the applications folder, and look at the "Starfield" folder. its the exact same thing. he just added in a speed var. and its unefficient too. 3 different files. lol.
Zitat von pspgamer81
you sicken me.--------------------------------------------------------------------------------------
-
11-26-2006, 03:25 PM #4340QJ Gamer Bronze
- Registriert seit
- Jul 2005
- Ort
- USA
- Beiträge
- 496
- Points
- 14.090
- Level
- 77
- Downloads
- 0
- Uploads
- 0
^^ I thought the same thing, but didn't bother to check it out. tisktisktisk
-
11-26-2006, 03:28 PM #4341QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
it is i never bothered to delete the example off i thought so to
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
11-26-2006, 04:52 PM #4342lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Is ther a working return to XMB function, But for 2.71 SE-C?
Or if thier is a working one, What firmwares does it work on?
All i know of is
But it doesnt work...Code:if pad:start() then os.exit() end
-
11-26-2006, 05:02 PM #4343QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
unless you compile the luaplayer it well bring you back to the luaplayer menu but it is break
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
11-26-2006, 05:54 PM #4344lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
So i should just use this:
Code:if pad:start() then break end
-
11-26-2006, 05:58 PM #4345I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
Sigh. break does NOT exit back to the XMB. It transfers from one loop to another. The only ways to go the XMB are the HOME button, os.exit() and System.Quit().
Zitat von pspgamer81

-
11-26-2006, 05:58 PM #4346lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Ok, I havent used System.Quit()
I better try it, Thanks!
-
11-26-2006, 06:05 PM #4347I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
It only works with the Lua Player mod by Cools.
Zitat von pspgamer81

-
11-26-2006, 06:05 PM #4348lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Thats the one im using.
-
11-26-2006, 06:12 PM #4349QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o well then now i know
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
11-26-2006, 10:11 PM #4350Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Was the function System.Quit() added in the Lua Player mod? Meaning if i put it on a regular Lua player would it say it is an error?
Zitat von Access_Denied
If you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum