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; Zitat von Gutya What if your not loading it in Lowser? What if its with an eboot? And also i ...
-
04-09-2006, 12:18 PM #1441Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
I will checkup on that...I think I saw some code somehwere for that involving 'break".
Zitat von Gutya
Zitat von Noriko
-
04-09-2006, 12:34 PM #1442
Ok cheers.
D:
-
04-09-2006, 01:51 PM #1443
break just quits a loop. The way to exit a file is to have all the code ran as far as I know.
-
04-09-2006, 02:04 PM #1444
It works if i put it in the main loop, but it won't allow me to put it in a function.
D:
-
04-09-2006, 03:04 PM #1445Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
--Loop in gettable. Help?Code:screen:blit(stick.x, stick.y, stick)

--XBL Gamertag: PhenoM904--
-
04-09-2006, 03:58 PM #1446Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
ok what is wrong with this? everything flickers....
and two, how do I make it so you only have to press X once for the animation to keep going, not hold it down?Code:if pad:cross()and status == 0 then x = math.sin(pi * 2 / 360 * time) * 150 + 192.5 screen:blit(0, 0, s11) time = time + 1 if time >= 180 then screen:blit(0, 0, s12) end if time >= 360 then time = 0 end screen.waitVblankStart() screen.flip() end
EDIT: I just realized that this is not the kind of code that I want. I want the animation to stay stationary. I am very confused.....Geändert von Greenskull (04-09-2006 um 04:04 PM Uhr)
-
04-09-2006, 04:12 PM #1447
So.. where can I learn about simple collision? In my game I'm not going to have any action or shooting or such, just need it to do something when I walk up to someone and press X.
-
04-09-2006, 04:48 PM #1448Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
ok i have a stationary animation code but it is not workign the way i want it to. I want it to last longer and it also, when it switches, doesnt go as far over as i want it. how do i do that?
Code:if pad:cross()and status == 0 then -- current player position playerX = 10 playerY = 10 -- blit current player animation image screen:blit((playerX - 1) * 16 - 4, (playerY - 1) * 16 - 4, s1pic, 1 + 25 * animation, 1, 156, 80) -- calculate next animation image animationSlowDown = animationSlowDown + 1 if animationSlowDown == 2 then animationSlowDown = 0 animation = animation + animationDirection if animation == 2 then animationDirection = -1 elseif animation == 0 then animationDirection = 1 end end
-
04-09-2006, 06:28 PM #1449TheMarioKartersGuest
Im having some trouble with my game...it's not displaying the right sprite. Please PM me if you can help.
-
04-09-2006, 06:45 PM #1450Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
Check AIM man, I fixed it already!
Zitat von TheMarioKarters
Zitat von Noriko
-
04-10-2006, 01:00 AM #1451
I have not seen a tutorial about simple collision yet...
Zitat von Spiritbeast
I might make one...D:
-
04-10-2006, 02:42 AM #1452Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Yea please do. I need to learn collision.
-
04-10-2006, 12:57 PM #1453<img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&

- Registriert seit
- Jun 2005
- Ort
- Canada
- Beiträge
- 1.944
- Points
- 11.105
- Level
- 69
- Downloads
- 0
- Uploads
- 0
i would appreciate a collision guide too,,
i think i have some idea how its done, but theres probably an easier way then what im thinking,,
so it would help out
-
04-10-2006, 02:05 PM #1454
If i get a bit of time tommorow ill look into it.
D:
-
04-10-2006, 02:18 PM #1455Is in your zone.

- Registriert seit
- Oct 2005
- Ort
- Jacksonville, FL
- Beiträge
- 3.429
- Points
- 24.342
- Level
- 94
- Downloads
- 0
- Uploads
- 0
i was thinking it might work like (well for my game)
Code:if stick.x == spike.x then screen:clear() screen:blit(0,0,death,false)

--XBL Gamertag: PhenoM904--
-
04-10-2006, 04:53 PM #1456<img src="images/smilies/psp.gif" border="0" alt="" title="" cl***="inlineimg" /> <img src="images/smilies/Punk.gif" border="0" alt="" title="" cl***=&

- Registriert seit
- Jun 2005
- Ort
- Canada
- Beiträge
- 1.944
- Points
- 11.105
- Level
- 69
- Downloads
- 0
- Uploads
- 0
when ever i try to put a timer function i ALWAYS get this error
attempt to index global 'Timer' (a nil value)
on that line i have this
timer = Timer.new()
what am i missing?
EDIT nvm,, it seems the eboot i was using didnt allow that functionGeändert von Sousanator (04-10-2006 um 06:02 PM Uhr)
-
04-10-2006, 06:34 PM #1457Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
that would be nice
Zitat von Sousanator
-
04-11-2006, 12:39 AM #1458Think, Do, Gloat.
- Registriert seit
- Nov 2005
- Ort
- England, Norwich
- Beiträge
- 1.422
- Points
- 12.687
- Level
- 73
- Downloads
- 0
- Uploads
- 0
For collision, as long as you specify the part of the thing which is colliding, and with what other object, it should be ok.
So if you specify an area of a character, then tell it if something lands in the same place, make it do the thing you want.
Don't know if it helps, it probably doesn't...
-
04-11-2006, 07:38 AM #1459
I added a screen
rint with a font and now i get no script file found...
D:
-
04-11-2006, 07:58 AM #1460Quality Haxing Since 1991
- Registriert seit
- Oct 2005
- Ort
- Pennsylvania, USA Fi
- Beiträge
- 6.206
- Points
- 29.255
- Level
- 99
- Downloads
- 0
- Uploads
- 0
Sned me a PM to remind me (I often forget) and I will sned you an example of how to print fonts and load them correctly with mono spacing and everyhting. I have a good one.
Zitat von Gutya
Zitat von Noriko
-
04-11-2006, 08:14 AM #1461
Ok. Done.
D:
-
04-11-2006, 11:26 AM #1462QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- Puerto Rico
- Beiträge
- 310
- Points
- 7.109
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I need a code:
pic A, pic B
pic A is loaded on the screen, when I press X pic A disappears and pic B appears. As long as I have the x button pressed pic B shows not pic A. When I let go of X pic B disappears and pic A appears again.
It sounds easy but I cant get it working.Thanks in advance and sorry for a stupid request.
-
04-11-2006, 11:44 AM #1463Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Ok try this:
That works for me!Code:--Load images pica = Image.load("Path to image") picb = Image.load("Path to image") --Begin the main loop while true do pad = Controls.read() screen:blit(0, 0, pica) if pad:cross() then screen:blit(0, 0, picb) end screen.flip() end
-
04-11-2006, 02:54 PM #1464Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
ok, how do I make this animation go slower?
-
04-11-2006, 02:56 PM #1465QJ Gamer Blue
- Registriert seit
- Feb 2006
- Ort
- Manila, Philippines
- Beiträge
- 228
- Points
- 4.734
- Level
- 43
- Downloads
- 0
- Uploads
- 0
you can change the CPU speed and max frame skip
-
04-11-2006, 03:11 PM #1466Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
sorry i forgot to post it... here
Code:if pad:cross()and status == 0 then -- current player position playerX = 10 playerY = 10 -- blit current player animation image screen:blit((playerX - 1) * 16 - 4, (playerY - 1) * 16 - 4, s1pic, 1 + 80 * animation, 1, 78, 80) -- calculate next animation image animationSlowDown = animationSlowDown + 1 if animationSlowDown == 2 then animationSlowDown = 0 animation = animation + animationDirection if animation == 2 then animationDirection = -1 elseif animation == 0 then animationDirection = 1 end end
Geändert von Greenskull (04-11-2006 um 03:16 PM Uhr)
-
04-11-2006, 03:42 PM #1467Simon Champion!
- Registriert seit
- Mar 2006
- Ort
- Calgary, Alberta, Ca
- Beiträge
- 537
- Points
- 11.489
- Level
- 70
- Downloads
- 0
- Uploads
- 0
how do i slow that down?
-
04-11-2006, 04:00 PM #1468QJ Gamer Silver
- Registriert seit
- Jun 2005
- Ort
- Puerto Rico
- Beiträge
- 310
- Points
- 7.109
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Thanks I'll try it.
Zitat von kozine
-
04-11-2006, 09:12 PM #1469QJ Gamer Bronze
- Registriert seit
- Jul 2005
- Ort
- Washington
- Beiträge
- 211
- Points
- 5.459
- Level
- 47
- Downloads
- 0
- Uploads
- 0
Can someone help me? Im trying to have a character move when I press right, here is what I have so far. Note: The "loading finished" does not disappear after 4 seconds, the character image blinks (probably due to the fact the image is not transparent) and the character does nothing when I press right. Can someone tell me whats wrong? Thanks in advance.
white = Color.new(255, 255, 255)
char = Image.load("char.png")
y = 100
screen
rint(100, 100, "loading finished", white)
screen.flip()
screen.waitVblankStart(24 0)
screen:clear()
screen:blit(150, y, char)
screen.flip()
pad = Controls.read()
if pad:right() then
y = y + 5
end
while true do
screen.waitVblankStart()
screen.flip()
endPsp firmware: 1.5 - Thank you 0okm and Fanjita! ^^
-
04-11-2006, 10:37 PM #1470
- Registriert seit
- Mar 2006
- Beiträge
- 7
- Points
- 4.063
- Level
- 40
- Downloads
- 0
- Uploads
- 0
You need to have your pad stuff inside your while loop. Like this:
white = Color.new(255, 255, 255)
char = Image.load("char.png")
y = 100
screenrint(100, 100, "loading finished", white)
screen.flip()
screen.waitVblankStart(24 0)
screen:clear()
while true do
pad = Controls.read()
if pad:right() then
y = y + 5
end
screen:blit(150, y, char)
screen.flip()
screen.waitVblankStart()
screen.flip()
end


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