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 need an efficient way to change levels in my game, Arkanoid Deluxe. Ive tried functions, they don't work. Ive ...
-
08-13-2008, 05:14 PM #9241
I need an efficient way to change levels in my game, Arkanoid Deluxe. Ive tried functions, they don't work. Ive tried dofile, it doesn't work. All I need to do is restate
For all 24 block. Because all that changes every level is the block positions.Code:Block = {} Block[1] = {x = 0, y = 0, visible = "true"}
Please Help.
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]
-
08-13-2008, 05:16 PM #9242Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Code:for i = 1, 24 do Block[i].visible = "true" end------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-13-2008, 05:24 PM #9243My 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]
-
08-13-2008, 05:36 PM #9244Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Code:for i = 1, 24 do Block[i].x = 0 Block[i].y = 0 Block[i].visible = "true" end------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-13-2008, 05:37 PM #9245QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
??Code:for i = 1, 24 do Block[i].visible = "true" Block[i].x = 0 Block[i].y = 0 end
Like that?
edit: I lost.
-
08-13-2008, 05:37 PM #9246Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Don't worry, Ummhhh. How many people on ad-hoc could you get to play at One given Time?
-
08-13-2008, 05:38 PM #9247
Geändert von xXChromeXx (08-13-2008 um 05: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]
-
08-13-2008, 05:39 PM #9248Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Code:for i = 1, 24 do Block[i].x = something * i Block[i].y = something * i Block[i].visible = "true" end------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-13-2008, 05:45 PM #9249My 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]
-
08-13-2008, 05:48 PM #9250Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
sorry here do something like this, this is the code taken from one of my breakout games.
Code:function display_bricks(brick_number) for i = 1, brick_number do if bricks[i].enabled == 1 then if i <= 6 then row = 1 elseif i <= 12 then row = 2 elseif i <= 18 then row = 3 end bricks[i].x = 30 + (((i - 1) - ((row - 1) * 6)) * 70) bricks[i].y = 20 + ((row - 1) * 20) screen:blit(bricks[i].x, bricks[i].y, bricks[i].img) end end end
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-13-2008, 05:51 PM #9251My 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]
-
08-13-2008, 05:55 PM #9252Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
basically it splits the bricks up into 3 rows, depending on the number of bricks you have on each row change the numbers 6, 12, and 18 so that you do get 3 rows or add some more code in if you want more rows.
the second part displays the brick at an x and y position depending on which row and brick that it is
if you need a more detailed explanation than ill have to do it tomorrow as im going bed now unless someone else that understands it tells you (not dan369)------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-13-2008, 05:59 PM #9253QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Fatboy he wants each level to have all kinds of different positions, not just to reset for each level
What I would do is make a 3d table - a table of tables of tables. First table is of all the different level tables and each level table is a table blocks, each block being a table. Simply switch which subtable of the first table you access for all the blocks to change which level youre on and have each different subtable be a different level.
If that makes any sense....
-
08-13-2008, 06:05 PM #9254Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Kind. Anyway, i'm not gunna bother trying to explain myself. because i don't know.
I'm wondering about using strings, is there a good tut or explanation about them?
Edit: Is it also possible to store tables in .txt files? if so he could dofile Various .txt files, which have drifferent tables. Just a Suggestion
-
08-13-2008, 06:06 PM #9255My 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]
-
08-13-2008, 06:06 PM #9256QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
http://lua-users.org/wiki/StringLibraryTutorial
chrome explain what you understand and what you dont and ill try to elaborate
-
08-13-2008, 06:09 PM #9257My 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]
-
08-13-2008, 07:47 PM #9258QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
make a table:
with some tables inside it:Code:levels = {}
with some more tables inside them:Code:levels = {{},{},{}}
The very inside tables are each a block. The tables a level above those are a "level" and the whole big table is all the levels. When you want to be on level 1, use levels[1][1]-levels[1][howevermanyblocksthatleve lhas]Code:levels = { {{},{},{}}, {{},{},{}}, {{},{},{}} }
When you want level 5 use levels[5][1] to levels[5][howevermanyblockthatlevel has]
-
08-14-2008, 05:55 AM #9259QJ Gamer Blue
- Registriert seit
- Dec 2007
- Ort
- dfgd
- Beiträge
- 66
- Points
- 4.008
- Level
- 40
- Downloads
- 0
- Uploads
- 0
I new what dan had put was wrong as soon as i read it lol and i new i needed listdirectory etc but i had no actual clue on how to get the name of files in a a directory and put them in a table then print that table to the screen, so the user can then select a save but you have shown me near enough how to do it so i have to create something that will let me choose a file aswell so thankyou for the example.

PS: dan before you post something that your not too sure about try your idea thats what i do, if it dont work dont post and vice versa.
-
08-14-2008, 06:17 AM #9260Lua guy
- Registriert seit
- Jan 2008
- Ort
- Wales, cardiff
- Beiträge
- 1.442
- Points
- 11.690
- Level
- 71
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Don't worry i'm not gunna post in here any more, i can't be bothered arguing. (well unless i need help)
Anyway back on topic, what does string.byte() do? this string function confuses me :S
-
08-14-2008, 06:44 AM #9261My 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]
-
08-14-2008, 06:55 AM #9262QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
"But would I call it by [1][1]to[1][24]"
If level one has 24 blocks, yes, and put all of those block tables within the first subtable of the whole big table.
dan - use google, a simple "lua string.byte" returns two complete thorough explanations for the first and second results
-
08-14-2008, 07:02 AM #9263
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]
-
08-14-2008, 07:50 AM #9264QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
.....
no. you're doing it wrong. why do you have b1.*, b2.*, etc? its being declared within the table so just do {x = whatever, y = whatever, img = whatever} for that one table and then to access it its levels[1][1].x levels[1][1].y etc
and its just tables, its like grouped variables, theres no reason it would use more cpu and its not like arkanoid needs all the cpu it can get in the first place
-
08-14-2008, 07:52 AM #9265My 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]
-
08-16-2008, 07:40 PM #9266QJ Gamer Green
- Registriert seit
- Nov 2007
- Beiträge
- 6
- Points
- 2.866
- Level
- 32
- Downloads
- 0
- Uploads
- 0
EDIT: NVM fixed it! And is there a way to make a count down timer? like something thats basically a egg timer... and is there a war to implement a way to stop a timer? like after a certain "code" is pressed in(Like cross, cross, triangle circle)
Sorry for being such a newb haha, been searching for hours and i can't figure out how to make one.Geändert von psporpcp (08-17-2008 um 03:29 AM Uhr)
-
08-17-2008, 06:22 AM #9267
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]
-
08-17-2008, 02:36 PM #9268QJ Gamer Green
- Registriert seit
- Nov 2007
- Beiträge
- 6
- Points
- 2.866
- Level
- 32
- Downloads
- 0
- Uploads
- 0
-
08-17-2008, 02:52 PM #9269My 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]
-
08-17-2008, 03:18 PM #9270QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
You're failing to see that he wants to do a countDOWN timer to display to the user so that they run out of time counting down to zero.
That can be done by using a normal counter counting up to the time they have and then when you print it out to show them how much time they have left use (totaltimetheyhave-timeonthetimer) to get countdowntimer


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