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; have u tried this on a PSP yet because it doesnt work on the Lua Player for Windows...
-
12-22-2005, 09:32 PM #391QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
have u tried this on a PSP yet because it doesnt work on the Lua Player for Windows
[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-22-2005, 09:33 PM #392QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
worked on my psp
make sure you save it as index.lua if your using LUA player with a lowser
and did you take out the spaces that the forum makes? like between numbers and stuff?
-
12-22-2005, 09:36 PM #393QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
spaces? which ones
[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-22-2005, 09:39 PM #394QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
Code:yellow = Color.new(255, 255, 0) blue = Color.new(0, 0, 255) orange = Color.new(223, 88, 6) grey = Color.new(94, 97, 111) black = Color.new(0, 0, 0) MAKE SURE THERES NO SPACES IN THE COLOR VALUE NUMBERS background = Image.load("background.png") screen:blit(0, 0, background, false) screen.flip() screen.waitVblankStart(12 0)AND IN PLACES LIKE HERE IN BETWEEN TEH 12 AND 0 screen:blit(0, 0, background, false) screen:print(150, 130, "Welcome To pspBaller Beta!", blue) screen.flip() screen.waitVblankStart(18 0) HERE screen:blit(0, 0, background, false) screen:print(40, 150, "Thank you for waiting, now Press X for Tutorial", blue) screen.flip() screen.waitVblankStart(12 0) HERE pad = Controls.read() if pad:cross() then screen:blit(0, 0, background, false) screen:print(40, 150, "Welcome to the Tutorial For pspBaller", blue) screen.flip() screen.waitVblankStart(40 0) HERE end AND CHECK FOR RANY OTHER SPACES YOU MIGHT SEE
-
12-22-2005, 09:59 PM #395QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- The Migrant Fleet
- Beiträge
- 908
- Points
- 9.678
- Level
- 66
- Downloads
- 0
- Uploads
- 0
anyone know what might be wrong with this code?
its supposed to be a tic-tac-toe program with different features.
one problem is that it doesnt start, and I dont know where yall get those errors, whenever a program doesnt run on my psp it just doesnt do anything.
help please
Code:background = Image.load("background.png") white = Image.load("white.png") black = Image.load("black.png") cursor = Image.load("cursor.png") cursorx = 247 cursory = 123 screen:blit(0, 0, background, false) screen:blit(247, 123, cursor) screen.flip() while true do screen.waitVblankStart() function white1() screen:blit(305, 31, white) screen.flip() screen.waitVblankStart() end function white2() screen:blit(305, 120, white) screen.flip() screen.waitVblankStart() end function white3() screen:blit(305, 211, white) screen.flip() screen.waitVblankStart() end function white4() screen:blit(217, 32, white) screen.flip() screen.waitVblankStart() end function white5() screen:blit(217, 117, white) screen.flip() screen.waitVblankStart() end function white6() screen:blit(217, 203, white) screen.flip() screen.waitVblankStart() end function white7() screen:blit(134, 31, white) screen.flip() screen.waitVblankStart() emd function white8() screen:blit(134, 117, white) screen.flip() screen.waitVblankStart() end function white9() screen:blit(134, 208, white) screen.flip() screen.waitVblankStart() function black1() screen:blit(305, 31, black) screen.flip() screen.waitVblankStart() end function black2() screen:blit(305, 120, black) screen.flip() screen.waitVblankStart() end function black3() screen:blit(305, 211, black) screen.flip() screen.waitVblankStart() end function black4() screen:blit(217, 32, black) screen.flip() screen.waitVblankStart() end function black5() screen:blit(217, 117, black) screen.flip() screen.waitVblankStart() end function black6() screen:blit(217, 203, black) screen.flip() screen.waitVblankStart() end function black7() screen:blit(134, 31, black) screen.flip() screen.waitVblankStart() emd function black8() screen:blit(134, 117, black) screen.flip() screen.waitVblankStart() end function black9() screen:blit(134, 208, black) screen.flip() screen.waitVblankStart() pad = Controls.read() if pad:left() then cursorx = cursorx - 85 end if pad:right() then cursorx = cursorx + 85 end if pad:up() then cursory = cursory + 76 end if pad:down() then cursory = cursory - 76 end if pad:square() then cursorx = cursorx - 85 end if pad:circle() then cursorx = cursorx + 85 end if pad:triangle() then cursory = cursory + 76 end if pad:cross() then cursory = cursory - 76 end if cursorx > 296 then if cursorx < 361 then if cursory > 12 then if cursory < 81 then if pad:l() then white1() end if cursorx > 296 then if cursorx < 361 then if cursory > 92 then if cursory < 175 then if pad:l() then white2() end if cursorx > 296 then if cursorx < 361 then if cursory > 185 then if cursory < 259 then if pad:l() then white3() end if cursorx > 205 then if cursorx < 284 then if cursory > 12 then if cursory < 81 then if pad:l() then white4() end if cursorx > 205 then if cursorx < 284 then if cursory > 92 then if cursory < 175 then if pad:l() then white5() end if cursorx > 205 then if cursorx < 284 then if cursory > 186 then if cursory < 258 then if pad:l() then white6() end if cursorx > 128 then if cursorx < 193 then if cursory > 12 then if cursory < 81 then if pad:l() then white7() end if cursorx > 128 then if cursorx < 193 then if cursory > 92 then if cursory < 175 then if pad:l() then white8() end if cursorx > 128 then if cursorx < 193 then if cursory > 186 then if cursory < 258 then if pad:l() then white9() end if cursorx > 296 then if cursorx < 361 then if cursory > 12 then if cursory < 81 then if pad:r() then black1() end if cursorx > 296 then if cursorx < 361 then if cursory > 92 then if cursory < 175 then if pad:r() then black2() end if cursorx > 296 then if cursorx < 361 then if cursory > 185 then if cursory < 259 then if pad:r() then black3() end if cursorx > 205 then if cursorx < 284 then if cursory > 12 then if cursory < 81 then if pad:r() then black4() end if cursorx > 205 then if cursorx < 284 then if cursory > 92 then if cursory < 175 then if pad:r() then black5() end if cursorx > 205 then if cursorx < 284 then if cursory > 186 then if cursory < 258 then if pad:r() then black6() end if cursorx > 128 then if cursorx < 193 then if cursory > 12 then if cursory < 81 then if pad:r() then black7() end if cursorx > 128 then if cursorx < 193 then if cursory > 92 then if cursory < 175 then if pad:r() then black8() end if cursorx > 128 then if cursorx < 193 then if cursory > 186 then if cursory < 258 then if pad:r() then black9() endGeändert von montrob (12-23-2005 um 12:19 PM Uhr)
-
12-23-2005, 06:08 AM #396QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
what's the code supposed to do?
-
12-23-2005, 01:36 PM #397QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 375
- Points
- 5.631
- Level
- 48
- Downloads
- 0
- Uploads
- 0
I have two questions. I want to start programing in lua so I decided to start on a simple program. How exactly do I make a menu and how do I tell the program to do a math problem?
-
12-23-2005, 05:08 PM #398QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
hmm im gettinga Weird Error when i try to Use Lua for Windows to Run pspBaller when i ran some code, it says "error: script.lua:52: no loop near 'end" here is the code by endCode:if pad:select() then screen:save("screenshot.tga") end if pad:start() then break end end[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-23-2005, 05:18 PM #399QJ Gamer Green
- Registriert seit
- Oct 2005
- Ort
- Indiana
- Beiträge
- 46
- Points
- 11.125
- Level
- 69
- Downloads
- 0
- Uploads
- 0
You have an extra end at the end of it. If it is ending a loop, then thats a different story. If you intend to loop it, then make sure there is a loop to start it off.
Zitat von KINGOFNOOBS
[SIZE=1][CENTER]Some of my accomplishments in the Sonic community:
[INDENT][SIZE=1][URL="http://www.s2beta.com/forums/index.php?showtopic=8365"]Sonic in Chaotix (Revision 2)[/URL][/SIZE][SIZE=1]
[URL="http://www.s2beta.com/forums/index.php?showtopic=8116"]Knuckles' Chaotix Art Editor C++ Port[/URL][/SIZE][/INDENT][/CENTER]
[/SIZE]
-
12-23-2005, 10:55 PM #400QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
hmm how would u make it to make it so when u press lets say, Right on the PSP Pad it moves a Object, and how would u make it so u could control how much it moves, and also how would it know what object move?
[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-24-2005, 12:20 AM #401QJ Gamer Blue
- Registriert seit
- Dec 2005
- Beiträge
- 82
- Points
- 5.303
- Level
- 46
- Downloads
- 0
- Uploads
- 0
That's how to control an image with the D-Pad
Zitat von Neodudeman
That's controlling with the Analog!
Zitat von Neodudeman
Hope that helps!
-
12-24-2005, 12:25 AM #402QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
so for my game, pspBaller ( i think u have seen it ) which way would better?
[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-24-2005, 12:28 AM #403QJ Gamer Blue
- Registriert seit
- Dec 2005
- Beiträge
- 82
- Points
- 5.303
- Level
- 46
- Downloads
- 0
- Uploads
- 0
pspBaller? Err... lol, i haven't seen it. Though i'm willing to look
-
12-24-2005, 12:32 AM #404QJ Gamer Blue
- Registriert seit
- Dec 2005
- Beiträge
- 82
- Points
- 5.303
- Level
- 46
- Downloads
- 0
- Uploads
- 0
Thoughhhhhhhh... not now... I need sleep now.. lol... it's 4 am here good night!
ACTUALLY
That game is lookin pretty sweet! I would recommend using the Analog stick, just because it feels nicer.. Though it depends on your engine. If it's REALLY linear, like, if 1+1=2 then you'd have to go with D-Pad, because the Analog outputs stuff like 89.23 and what not. BUT If it's a kinda Speeded Engine, like, If D-Pad, x=x+d-pad:left Then I would Totally recommend putting in analog stick to the addition, though the math would be harder.Geändert von Neodudeman (12-24-2005 um 12:36 AM Uhr)
-
12-24-2005, 12:34 AM #405QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
http://forums.qj.net/psp-development-forum/
and also another question, how would u set a collision of a object?
like if i wanted it to be like if the ball hits something it just simply bouces back up?[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-24-2005, 12:39 AM #406QJ Gamer Blue
- Registriert seit
- Dec 2005
- Beiträge
- 82
- Points
- 5.303
- Level
- 46
- Downloads
- 0
- Uploads
- 0
lol... and Suddenly Things Went Bad....
Collision is Not my forte. lol. If i knew collision, I would be Out there in the Ether man... But what i Can tell you is that you're going to be needing some angle algorithms if you want to do some bouncing off walls.
Possibly you can assign certain areas of the screen as "walls" ? Maybe like, when the ball Touches a wall, reverse the x, or y, depending on the wall. Like if it was a Top or Bottom wall, reverse the Y, so that it would still travel the X coordinate, but would "bounce" off the Y. See? and it if was a vertical wall, reverse the X.
Sorry, but i Seriously have to sleep now.. lol. I wish i could help more, but i'm about to keel over with sleep deprevation. Good Night!
-
12-24-2005, 05:39 AM #407
to make borders do like this :
Also, I wonder if it is possible to have pics in an array or if they only hold numbers and how do I call an array?Code:--set these limits for your character to be kept onscreen --x and y are your characters cordinates leftlimit = 10 rightlimit = 460 uplimit = 20 downlimit = 260 --if statement added during control init (enforcing limits) if x<=leftlimit then x=leftlimit elseif x>=rightlimit then x=rightlimit end if y<=uplimit then y=uplimit elseif y>=downlimit then y=downlimit end
-
12-24-2005, 08:47 AM #408QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
i have some questions about the math.random() function and music files
1. How would i make an enemy appear on the x axis in spaces like this(not exactly like that, but you get it):
-------|---------------|----|----------|----------|
|, representing my enemy
2. with wav files, what does the config on them got to be? or is there a program i can use to make xm's or mod files?
-
12-24-2005, 10:51 PM #409QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
ahh another question, how exactly would i make a tile set? like u want to play more then one object in more then one place, would u just simply do:
tile
x=1
y=1
tile
x=2
y=2
or would u keep using the Screen:Blit Command?[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-26-2005, 03:08 AM #410
a tile set? you mean like a map or such?
-
12-26-2005, 03:37 AM #411QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- Grand Line
- Beiträge
- 5.996
- Points
- 40.380
- Level
- 100
- Downloads
- 0
- Uploads
- 0
yea exactly what i mean, but i mean like how would u have it to make it each object on the map have diffrent properties
[CENTER][IMG]http://img130.imageshack.us/img130/1640/acefcbanner2wo9.gif[/IMG]
[SIZE=1][B]I'm soo hot[/B][/SIZE]
[/CENTER]
[SIZE=2][CENTER][/SIZE][/CENTER]
[center]Sorry. No Advertising[/center]
-
12-26-2005, 06:11 AM #412
Well I aint sure on this but I guess something like this would work
Code:System.usbDiskModeActivate() tiles = Image.load("tiles.png") map = { "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmeaaaaaaaaaaaaaaaaaaaaaaaafmm", "mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm", "mmdokcccccclnkccccccccccclnbmm", "mmdojaaaaafdnbmmmmmmmmmmmdnbmm", "mmdooooooobdnbmmmmmmmmmmmdnbmm", "mmdokccclobdnbmmmmmmmmmmmdnbmm", "mmdobmmmdobdnbmmmmmmmmmmmdnbmm", "mmdobmmmdobdnjaaaaaaaaaafdnbmm", "mmdobmmmdpbdnnnnnnnnnnnnbdnbmm", "mmdobmmmhcghcccccccccclnbdnbmm", "mmdojaaaaaaaaaaaaaaaaainjinbmm", "mmdpnnnnnnnnnnnnnnnnnnnnnnpbmm", "mmhccccccccccccccccccccccccgmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm" } function drawTile(tile, x, y) local tileX = math.mod(tile, 4) local tileY = math.floor(tile / 4) screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false) end while true do pad = Controls.read() if pad:start() then break end screen:clear() for y = 1, 17 do line = map[y] for x = 1, 30 do tile = string.byte(line, x) - string.byte("a") drawTile(tile, x - 1, y - 1) end end screen.waitVblankStart() screen:flip() end
-
12-29-2005, 12:35 PM #413QJ Gamer Blue
- Registriert seit
- Jun 2005
- Beiträge
- 152
- Points
- 5.114
- Level
- 45
- Downloads
- 0
- Uploads
- 0
can someone give me a hand here
Zitat von monster356
this was my post from before(in the quote...DUH)
-
01-06-2006, 05:41 PM #414
- Registriert seit
- Jun 2005
- Beiträge
- 36
- Points
- 4.715
- Level
- 43
- Downloads
- 0
- Uploads
- 0
Try using something like this within your main loop:
Zitat von monster356
if math.random(1,300) == 150 then
addEnemy(math.random(100, 400))
replace the math.random values with your own to define how frequently enemies will appear, replace the 100,400 values with your own x,y values to give the area spread your enemy will appear in, and define your enemy image as "Enemy".... I think... dont hold me to that. :)
-
01-07-2006, 08:54 AM #415
- Registriert seit
- Jan 2006
- Beiträge
- 19
- Points
- 4.313
- Level
- 41
- Downloads
- 0
- Uploads
- 0
hey it's monster356, i got banned, for like no reason....no one pmed me with a warning, and no one told me i was going to get banned......
so, the addEnemy is a blit?
-
01-12-2006, 11:29 AM #416
- Registriert seit
- Dec 2005
- Beiträge
- 14
- Points
- 4.281
- Level
- 41
- Downloads
- 0
- Uploads
- 0
hey all,
i've finally decided on a game to make with lua, but am quite new to it. I understand basic programming (mostly in BASIC and Fortran, a little C++, from engineering school), but not so much for gaming programs. The game is relatively simple, but there are a few hurdles I need to overcome to make it happen.
Anyway.... the game I have in mind is known as "SameGame" for PC or "Macigame" for MAC as well as many other versions/clones. Essentially, the game is a grid of tiles that when 2 or more tiles touch they can be selected and removed from the grid, whereupon the grid then "collapses" depending on what is removed. Clearing the grid fully and/or highscore is the object of the game.
Some of my initial problems include: (again, I am new to game or graphics-based programming so I don't even know how problematic they may be)
1. Creating a known-sized grid built from randomly selected tiles. i.e. I can build a pre-arranged grid from a tileset(similar to the pacman style gameboards) but am unsure how to make it randomly generated.
2. Use of a cursor to select blocks of touching tiles, where when the cursor is placed over a suitable group this group would become highlighted, or selectable to be removed.
Any help or pointing me in the right direction is greatly appreciated.
Thanks...
-
01-20-2006, 05:18 PM #417
- Registriert seit
- Jan 2006
- Beiträge
- 22
- Points
- 4.266
- Level
- 41
- Downloads
- 0
- Uploads
- 0
hey I'm kinda a newbie at this but here's my question. I'm making a fighter and I made it so that the character can move to each side of the screen and not go past but I want to make it so that the image changes so that it faces the direction it's going. can someone help me?
-
01-20-2006, 06:29 PM #418QJ Gamer Gold
- Registriert seit
- Jul 2005
- Ort
- GA | Banned: 3 | Warned: 3
- Beiträge
- 2.253
- Points
- 12.479
- Level
- 73
- Downloads
- 0
- Uploads
- 0
if facing==1 then
Zitat von Ace Hih
screen:blit(X,Y,Pic facing left)
end
if facing==2 then
screen:blit(X,Y,pic facing right)
end
if pad:left() then
facing = 1
imagex = imagex - 3
end
if pad:right() then
facing = 2
imagex = imagex +3
end
-
01-20-2006, 09:00 PM #419
- Registriert seit
- Jan 2006
- Beiträge
- 22
- Points
- 4.266
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Thank you so much. This thread is great!
-
01-20-2006, 09:41 PM #420
- Registriert seit
- Jan 2006
- Beiträge
- 22
- Points
- 4.266
- Level
- 41
- Downloads
- 0
- Uploads
- 0
I hate to be annoying but for some reason it won't work.It worked before I added the code with the comments. here's my code:
System.usbDiskModeActivat e ()
field = Image.load("Naruto forestc.PNG")
block3 = Image.load("player.PNG")
player = Image.load(player2.PNG")
blockposX = 152
blockposY = 195
while true do
screen:blit(0, 0, field)
screen:blit(blockposX, blockposY, block3)
if blockposX <= 2 then
blockposX = 1
end
if blockposX >= 447 then
blockposX = 448
end
if facing==1 then --------This section
screen:blit(blockposX, blockposY, player)
end
if facing==2 then --------This section
screen:blit(blockposX, blockposY, block3)
end
pad = Controls.read()
if pad:left() then
facing = 1 ---------This Line
blockposX = blockposX - 5
end
if pad:right() then
facing = 2 ---------This Line
blockposX = blockposX + 5
end
screen.waitVblankStart()
screen.flip()
if pad:start() then
break
end
end
What did I do wrong?
Oh yeah and I ripped part of the code from someones example on this page for learning purposes. So props to themGeändert von Ace Hih (01-20-2006 um 09:47 PM Uhr)


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