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; i'll agree with Nielkie, you should be fine with box collision, but a pixel collision would not appear to have ...
-
10-29-2008, 02:12 PM #9481QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i'll agree with Nielkie, you should be fine with box collision, but a pixel collision would not appear to have "gaps" between a collision, however if box collision is done correcltly only minor "gaps" would ever appear
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
-
10-29-2008, 03:15 PM #9482
Ok thanks
-=Double Post Merge =-
Can I do collision based on the color of an object? Like if a platform is red my player cant go through it?Geändert von xXChromeXx (10-29-2008 um 03:39 PM Uhr) Grund: Automerged Doublepost
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
10-30-2008, 04:41 AM #9483Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Yes you can.
-
10-30-2008, 11:42 AM #9484
How would I do it?
I don't need straight code I just want an explanation.My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
10-30-2008, 03:02 PM #9485QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
basically you'll need to internally keep track of what tile is what, than simple loop though the tiles, check if you can move though that tile, than move or don't move though it, it's all internal tracking, it's only the graphics side that display's it's a red tile
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
-
10-30-2008, 04:15 PM #9486
Thank You
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
10-31-2008, 05:49 AM #9487Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
-
10-31-2008, 12:14 PM #9488QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o, i did not know this, however i believe internal tracking would be faster than checking an rgb value, however do toss out the info for Chrome to know, and for me to know for future refrence
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
-
10-31-2008, 12:22 PM #9489Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
I will do once he comes online. And you're right I think your way is faster.
-
10-31-2008, 12:46 PM #9490
What is your method eldiablov?
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-01-2008, 07:42 PM #9491
My jumping script isn't working. Once the player hits the ground I can't jump again. http://www.sendspace.com/file/azor5n
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-01-2008, 07:55 PM #9492QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
for future reference:
rafb.net/paste
or use code tags if your just giving use the script anyways
anywho, let me take a look, probably something simple your forgetting to do
edit:
think i got it:
^^obj1 has to meet the following(at least from how i'm reading it):Code:if (obj1.x + obj1.img:width() > obj2.x) and (obj1.x < obj2.x + obj2.img:width()) and (obj1.y + obj1.img:height() > obj2.y) and (obj1.y < obj2.y + obj2.img:height()) then
1. be smaller than obj2.
2. be completely inside obj2
which, in most cases that won't happen, i suggest revising it for checking only when one point intersects with obj2, or even making it more advanced and giving feedback depending on what side obj1 is hitting obj2, which could defiantly help you in the future(at least with the suspicion of what i believe your trying to do, and it only takes just a few extra if statements to do this)Geändert von slicer4ever (11-01-2008 um 08:05 PM Uhr)
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-02-2008, 04:39 AM #9493
Sorry the code was long and my only internet resource atm is my PS3 and I really didnt want to type it on its crappy OSK. Thanks ill try checking whether im hitting the top or bottom. Edit: obj1 doesn't have to be smaller or inside obj2 once they touch it works. But I think your right about checking specific areas.
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-02-2008, 08:51 AM #9494QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
ok, now i got it, and sorry about pointing in wrong direction, was late when i read it, but it's around the same issue:
^^as soon as you begin to jump, it'l start falling again, so to comphisate i did:Code:function checkCollision(obj1,obj2) if (obj1.x + obj1.img:width() > obj2.x) and (obj1.x < obj2.x + obj2.img:width()) and (obj1.y + obj1.img:height() > obj2.y) and (obj1.y < obj2.y + obj2.img:height()) then if obj1 == Player then Player.jumpstate = "ground" end else Player.jumpstate = "falling" end end
and secondly, it still won't jump, because it is slightly embeded into the green block at this point, which means that as soon as you begin to jump the collision function says it's hitting, and sets it back to ground, to compensate i did:Code:function checkCollision(obj1,obj2) if (obj1.x + obj1.img:width() > obj2.x) and (obj1.x < obj2.x + obj2.img:width()) and (obj1.y + obj1.img:height() > obj2.y) and (obj1.y < obj2.y + obj2.img:height()) then if obj1 == Player then Player.jumpstate = "ground" end else if Player.jumpstate~="jumping" then Player.jumpstate = "falling" end end end
and with those two changes the block was jumping all over the screenCode:function playerjump() if Player.jumpstate == "ground" then if pad:cross() then Player.jumpstate = "jumping" Player.y = Player.y - 3; // <-- now it'll move itself out of the block slightly so this way the collision function won't happen end elseif Player.jumpstate == "jumping" then Player.y = Player.y - 3 jumptime = jumptime + 1 if jumptime >= 30 then Player.jumpstate = "falling" jumptime = 0 end elseif Player.jumpstate == "falling" then Player.y = Player.y + 3 end end
hope this helps1. 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-02-2008, 09:31 AM #9495
Thanks alot
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-02-2008, 05:34 PM #9496QJ Gamer Blue
Achievements:
- Registriert seit
- Aug 2008
- Beiträge
- 26
- Points
- 2.426
- Level
- 29
- Downloads
- 0
- Uploads
- 0
Are you sure you want a jumping and falling state? It will cause problems when you start adding other objects. Just have a moving state and it resets when you hit the top or bottom of an object and slows down when you hit the side based on friction (this means every side of the object has to have its own collision though).
Geändert von MoAShaun (11-03-2008 um 09:52 PM Uhr)
-
11-02-2008, 05:47 PM #9497Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
^ i agree with MoAShaun, i think it wouldn't cause Huge problems But annoying ones using a boolean rather than a string it would be easier.
Geändert von dan369 (11-02-2008 um 05:48 PM Uhr) Grund: Fixing spelling errors
-
11-04-2008, 12:09 PM #9498QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- GA, USA
- Beiträge
- 243
- Points
- 9.319
- Level
- 64
- Downloads
- 0
- Uploads
- 0
Never mind. I fixed my problem.
Geändert von corytheidiot1 (11-04-2008 um 12:52 PM Uhr)
My Anime List || My Homepage- Keep up with my projects || Userbar
Projects:
Unamed RPG- In Progress
Lua File Manager & Extraction GUI
PSP Soundboard
-
11-06-2008, 12:58 PM #9499
I need help with a level editor for my arkanoid deluxe game. Im not even sure how to start. Creating levels was a pain and a level editor would help me out and be a good addition to the game.
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-06-2008, 02:15 PM #9500QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
You should start by telling us how your levels are stored...
-
11-06-2008, 02:54 PM #9501
I need a maximum of 30 blocks.
The tables are like this
Block = {}
Block[1] = {x = blah, y = blah, img = blah}
Block[2] = {x = blah, y = blah, img = blah}
...
Block[30] = {x = blah, y = blah, img = blah}My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-10-2008, 10:28 AM #9502
Can anyone help? Even just to point me in the right direction.
My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-10-2008, 10:45 AM #9503Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
There's an insert table function in Lua ;)
-
11-10-2008, 03:31 PM #9504QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
table.insert(tablename, the thing you want to insert, optionally the place where you want to insert it otherwise defaults to the end)
[size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]
-
11-10-2008, 03:50 PM #9505
Thanks I already googled it though lol.
Can I use infinite arguments? Like
table.insert(BLOCK, BLOCK[1] = {x = blah, y = blah}, .... BLOCK[30] = {})
Im just not totally clear how it works.My Releases:
---------------------------------------------------
[URL="http://forums.qj.net/showthread.php?t=145654"]ROFLFlasher[/URL]
[URL="http://forums.qj.net/showthread.php?t=144892"]DTS MGS Edition[/URL]
[URL="http://forums.qj.net/showthread.php?t=143735"]Arkanoid Deluxe Beta[/URL]
[URL="http://forums.qj.net/showthread.php?p=2144700#post2144700"]SAVIOR![/URL]
-
11-10-2008, 11:54 PM #9506QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
No
table.insert would work like this:
Code:table.insert(BLOCK, {x = blah, y = blah, img = blah})
-
11-14-2008, 09:47 AM #9507
Achievements:
- Registriert seit
- Oct 2008
- Beiträge
- 18
- Points
- 2.282
- Level
- 28
- Downloads
- 0
- Uploads
- 0
OK
How do I keep text on screen after I select something.
Like when I hit something I have to hold that button for the next set of text to stay. Like if I have to hit Cross(x) for text to appear then I have to hold it for that text to stay. How do I make it so the next text stay up even after I release X?
A sample code would be superb
-
11-14-2008, 11:08 AM #9508Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Use oldpad
Code:oldpad = Controls.read() --MAIN LOOP if pad:cross() and oldpad:cross() ~= pad:cross() then --Display text end --End loop screen.waitVblankStart() screen.flip() oldpad = pad --Make sure you have this end
-
11-14-2008, 11:55 AM #9509
Achievements:
- Registriert seit
- Oct 2008
- Beiträge
- 18
- Points
- 2.282
- Level
- 28
- Downloads
- 0
- Uploads
- 0
-
11-14-2008, 02:17 PM #9510Seven Year Vet. BOW DOWN.

- Registriert seit
- Dec 2005
- Ort
- Manchester, UK
- Beiträge
- 2.240
- Points
- 14.794
- Level
- 78
- My Mood
-
- Downloads
- 1
- Uploads
- 0
I'm a little lost. What exactly are you trying to do? You want it to display one message whilst X isn't being held, and another whilst X is being held? Also, if so, why exactl yisn't it working, what's happening instead?
Also, on a different note, I wanted to ask if there is any way I could fade from one image to another in lua? I know how to fade an image out to black, and then the next in, but is there no way I could do it straight from one to another? Thanks in advance.


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