Lua Player for PSP
Moderators: Shine, Insert_witty_name
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
http://haggar.pocketheaven.com/preview.zip <- Updated for the new API.
Don't post news about this updated Dr. Mario though (if any psp news site ppl are watching) ;)
Don't post news about this updated Dr. Mario though (if any psp news site ppl are watching) ;)
-
- Posts: 21
- Joined: Fri Jul 08, 2005 2:59 am
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
I guess you could do this:VgSlag wrote:I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop?
Code: Select all
if not mysound:playing() then
mysound:play()
end
Hmm... Mikmod has the ability, I'll have to write a wrapper. Gimme a while.VgSlag wrote:I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop?
If you want to do it with the current API, it's possible with a loop:
Code: Select all
sound = Sound.load("whatever.wav")
voice = sound.play()
while true do
game loop...
if not voice:playing() then
voice = sound:play()
end
end
Can't do music pausing, sorry. It's a bug in mikmod. [Edit: Or maybe.... If I... Hmm... I'll look into it.]
Sound pausing, I'll look into it.
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
nevyn wrote:Hmm... Mikmod has the ability, I'll have to write a wrapper. Gimme a while.VgSlag wrote:I have it all updated with the new API. Adding sounds now. Is there any way to get a wav file to loop?
If you want to do it with the current API, it's possible with a loop:Note the distinction between the data of a soundfile and a currently playing voice (sort of an "instance" of a sound)Code: Select all
sound = Sound.load("whatever.wav") voice = sound.play() while true do game loop... if not voice:playing() then voice = sound:play() end end
Can't do music pausing, sorry. It's a bug in mikmod. [Edit: Or maybe.... If I... Hmm... I'll look into it.]
Sound pausing, I'll look into it.
They added mikmod to psp media center I think, and you can pause the music there... Maybe you could take a look at the media center code or something? if they've released the source that is...
This is not a good idea, because if you want to play "looped" sounds, you will hear a gap between two plays. If Mikmod supports it, this should be used and called from Lua.nevyn wrote:Code: Select all
sound = Sound.load("whatever.wav") voice = sound.play() while true do game loop... if not voice:playing() then voice = sound:play() end end
I've got it working with the above code but you have your true and false mixed up that the function returns.
voice:playing() returns true when it's not playing, and false when it is or at least it seems that way.
With:
The above causes the sound to keep starting over itself where as:
The above makes it work.
G
voice:playing() returns true when it's not playing, and false when it is or at least it seems that way.
With:
Code: Select all
-- Has the sound finished?
if sound_torch_playing:playing() == false then
-- Yes, restart it
sound_torch_playing = sound_torch:play()
end
Code: Select all
-- Has the sound finished?
if sound_torch_playing:playing() == true then
-- Yes, restart it
sound_torch_playing = sound_torch:play()
end
G
I agree with Shine, my solution isn't exactly beautiful. There's no actual need to resort to these hacks anyway, as the release version of 0.7 WILL contain code to properly loop sounds.
Edit: Yes, I saw the bug with Sound:playing(), it'll be fixed... (forgot to negate a result)
Edit again: I managed to ugly-hack past the mikmod bug to allow pausing through Music.pause() and Music.resume(). Next up: pausing and looping of samples...
Edit: Yes, I saw the bug with Sound:playing(), it'll be fixed... (forgot to negate a result)
Edit again: I managed to ugly-hack past the mikmod bug to allow pausing through Music.pause() and Music.resume(). Next up: pausing and looping of samples...
That's exactly what beta releases are for, so no worries :P Thanks for your feedback, it's very helpful :) If any more bugs crop up, please tell!VgSlag wrote:Nicwe one Nev... wasn't hassling, just saying. I realise it's a nightmare when people start mentioning bugs with a beta release :)
Cheers for your work Nev and Shine.
-
- Posts: 15
- Joined: Tue Feb 08, 2005 6:36 pm
Hello all! I'm attempting to make an air hockey game, but I've noticed a small problem with my paddles. Sometimes they appear corrupted when I start the game.
It happens about once every four times I start the game. I was wondering if it's something I'm doing wrong. Any advice would be appreciated. Thank you.
Here is a normal screen shot:
Here is the script and stuff:
http://webpages.charter.net/aldanafx/st ... hockey.zip
P.S.
Thank you Shine and all who are contributing to Lua Player, I'm having so much fun learning to program. Thanks again.
It happens about once every four times I start the game. I was wondering if it's something I'm doing wrong. Any advice would be appreciated. Thank you.
Here is a normal screen shot:
Here is the script and stuff:
http://webpages.charter.net/aldanafx/st ... hockey.zip
P.S.
Thank you Shine and all who are contributing to Lua Player, I'm having so much fun learning to program. Thanks again.
hah nice indianajoneslim. for some reason i noticed that it locked up for a second with the controls and wouldnt move briefly, maybe a sound locking issue who knows.. but speaking of sound i like it, especially the yahoo! all this lua stuff makes me want to get back into it hehe. keep it up man =D also, would there be hard slap shots that would knock the disc/puck off the table? that could be some interesting play lol
- Dan
- Dan
Updated luaplayer at the repository. 0.7b7 adds music and sample looping, and music pausing and resuming. I tried sample pausing, but the resuming would crash the psp. Without a debugger, I don't feel like giving that one another try...
(It's hard to find time over to write code after my girlfriend came over for an extended visit :P I plan to fix Lowser tomorrow though, and add usb mode to Lowser... I have a great idea for a new Lowser interface, having a Dasher-like UI using the analog stick. Wish I had time to implement it...)
(It's hard to find time over to write code after my girlfriend came over for an extended visit :P I plan to fix Lowser tomorrow though, and add usb mode to Lowser... I have a great idea for a new Lowser interface, having a Dasher-like UI using the analog stick. Wish I had time to implement it...)
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
Thanks for this idea, there were some bugs which prevented you from doing this in Lua, so a new version can be downloaded, where these bugs are fixed and the changes from Nevyn are included: luaplayer-0.7b7.zipMikeHaggar wrote:Are there any way to rotate text 90 degrees right or left? I'm thinking about doing some vertical games and stuff.
Now it is possible to write your rotate function in Lua without problems, see the rotate.lua in the samples folder.
I sorta dislike rigid movement, so I couldn't help but to add acceleration to your game :P Hope you like it :)indianajonesilm wrote:Hello all! I'm attempting to make an air hockey game.
(Lowser-adapted it while at it, too)
http://ncoder.nevyn.nu/psp/pspairhockey.zip
Some more Lua for fun
This needs some 2 minutes to draw the picture, because it is not optimized, but it is worth the time:
Code: Select all
-- change this to select the view area
depth = 32
x0 = -0.65
y0 = -0.7
x1 = -0.5
y1 = -0.6
-- some nice palette
palette = {}
for i=0,depth do
b = math.floor(i / depth * 1024)
if b > 255 then
b = 255
end
g = math.floor((i - depth / 3) / depth * 1024)
if g > 255 then
g = 255
end
if g < 0 then
g = 0
end
r = math.floor((i - depth / 3 * 2) / depth * 1024)
if r > 255 then
r = 255
end
if r < 0 then
r = 0
end
palette[i] = Color.new(r, g, b)
end
palette[depth-1] = Color.new(0, 0, 0)
-- draw mandelbrot fractal
w = 480
h = 272
image = Image.createEmpty(w, h)
dx = x1 - x0
dy = y1 - y0
for y=0,h-1 do
for x=0,w-1 do
r = 0; n = 0; b = x / w * dx + x0; e = y / h * dy + y0; i = 0
while i < depth-1 and r * r < 4 do
d = r; r = r * r - n * n + b; n = 2 * d * n + e; i = i + 1
end
image:pixel(x, y, palette[i])
end
screen:blit(0, 0, image)
screen.waitVblankStart()
screen.flip()
end
screen:save("screenshot.tga")
while true do
screen.waitVblankStart()
end
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
I tried the included 1.5 eboots and, although I'm not sure if I set it up right, was unable to load the Lowser script. Is that normal? The error is: attempt to call global 'getColorNumber' (a nil value).nevyn wrote: Updated luaplayer at the repository. 0.7b7 ... I plan to fix Lowser tomorrow though, and add usb mode to Lowser...
I wasn't sure if that's expected with this version or not. (This is my first time to try Lua Player.)
This is entirely expected. The 0.7b7 is, as you can tell by the 'b', a beta. Lowser isn't updated to work with the new version yet. I recommend that, if you just want to try out LuaPlayer, you download version 0.6 from www.frank-buss.de/luaplayer/ . The non-beta version of 0.7 will be out in a few days.jambox wrote:I tried the included 1.5 eboots and, although I'm not sure if I set it up right, was unable to load the Lowser script. Is that normal? The error is: attempt to call global 'getColorNumber' (a nil value).nevyn wrote: Updated luaplayer at the repository. 0.7b7 ... I plan to fix Lowser tomorrow though, and add usb mode to Lowser...
I wasn't sure if that's expected with this version or not. (This is my first time to try Lua Player.)
Great! Thanks for the quick response. I'm looking forward to getting back into programming (even if it is the easy route :)..nevyn wrote:This is entirely expected. The 0.7b7 is, as you can tell by the 'b', a beta. Lowser isn't updated to work with the new version yet. I recommend that, if you just want to try out LuaPlayer, you download version 0.6 from www.frank-buss.de/luaplayer/ . The non-beta version of 0.7 will be out in a few days.jambox wrote:I tried the included 1.5 eboots and, although I'm not sure if I set it up right, was unable to load the Lowser script. Is that normal? The error is: attempt to call global 'getColorNumber' (a nil value).nevyn wrote: Updated luaplayer at the repository. 0.7b7 ... I plan to fix Lowser tomorrow though, and add usb mode to Lowser...
I wasn't sure if that's expected with this version or not. (This is my first time to try Lua Player.)