Lua Player for PSP
Moderators: Shine, Insert_witty_name
working on new project called "NORT"
hey everyone just thught id let everyone know im working on a project i like to call "NORT"
by looking at this picture i think you guys can guess how its gonna play :P
enyway, the thing im stuck with is the colition detection, i cant get it to work or cant figure out how to do it, can anyone point me to the right direction.
thanx
dragula96
UPDATE: NORT 0.1 is done get it here
http://www.megaupload.com/?d=23BCYZMZ
by looking at this picture i think you guys can guess how its gonna play :P
enyway, the thing im stuck with is the colition detection, i cant get it to work or cant figure out how to do it, can anyone point me to the right direction.
thanx
dragula96
UPDATE: NORT 0.1 is done get it here
http://www.megaupload.com/?d=23BCYZMZ
Last edited by dragula96 on Tue Aug 23, 2005 9:57 am, edited 2 times in total.
-
- Posts: 17
- Joined: Thu Jul 21, 2005 4:42 am
well this is embarresing :^(
i cant draw just a single pixle on the screen
i can draw a line but not a single pixle
please help this noob :^(
im trying this and it dont work:
blue = (0,0,255)
screen:drawpixel(x,y,blue)
screen.waitVblankStart()
screen.flip()
"attempt to call method 'drawpixel' ( a nil value)"
also tried
screen:pixel(x, y, blue)
and still get an error.
>:(
i can draw a line but not a single pixle
please help this noob :^(
im trying this and it dont work:
blue = (0,0,255)
screen:drawpixel(x,y,blue)
screen.waitVblankStart()
screen.flip()
"attempt to call method 'drawpixel' ( a nil value)"
also tried
screen:pixel(x, y, blue)
and still get an error.
>:(
Re: well this is embarresing :^(
Try image:drawpixel(x, y, blue)dragula96 wrote:i cant draw just a single pixle on the screen
i can draw a line but not a single pixle
please help this noob :^(
im trying this and it dont work:
blue = (0,0,255)
screen:drawpixel(x,y,blue)
screen.waitVblankStart()
screen.flip()
"attempt to call method 'drawpixel' ( a nil value)"
also tried
screen:pixel(x, y, blue)
and still get an error.
>:(
ok i got good news and bad news, the good news is that i got it to work...Evil Inside wrote:Nice, looks like it will be fun.
Take a look at Shine's snake for Collision detection.
You could also look at the PSP Air Hockey for multiplayer on one PSP controls.
... the bad news is that the graphics had to take a hit :*^(
ok now for some info... looks like if i work on it overnight after i get out of work, ill have a basic working 2 player version with player 1 controling the D pad and player 2 using the buttons.
then on future releases i will include better grafics and a single player mode with an AI controlled opponent.
just dont be expecting a speed demon like squarz... at least not on the first version.
P.S. if anyone knows of a way to blit on "layers" so that the bottom layer dont blit only the first one, please let me know because the only way i see this happenning with drawing a cycle on it is to:
draw the "lines" on the bottom layer and draw the cycle on the top one then only blitting the top layer and leaving the bottom one alone so the lines dont dissapear.
-dragula96
Last edited by dragula96 on Tue Aug 23, 2005 9:58 am, edited 1 time in total.
Re: well this is embarresing :^(
A pixel is a line with x0=x1 and y0=y1 (at least for Lua Player, not mathematical), but see http://www.luaplayer.org/functions.txt for the pixel function:dragula96 wrote:i cant draw just a single pixle on the screen
i can draw a line but not a single pixle
nil image:pixel(x, y, Color) --set
You can see the third parameter is a color object:
Code: Select all
blue = Color.new(0, 0, 255)
screen:pixel(100, 100, blue)
I don't understand what you mean, but sounds like it doesn't work. See the Snake game for an example with multiple layers. You have to draw your pixels to an image (which is called "snake" in the Snake game), blit this image every VSync to screen and then blit your cycles on top to the screen.dragula96 wrote:P.S. if anyone knows of a way to blit on "layers" so that the bottom layer dont blit only the first one, please let me know because the only way i see this happenning with drawing a cycle on it is to:
draw the "lines" on the bottom layer and draw the cycle on the top one then only blitting the top layer and leaving the bottom one alone so the lines dont dissapear.
-
- Posts: 13
- Joined: Wed Aug 03, 2005 9:48 pm
no im not, just the next one the old ones stay, but the problem is that everytime it moves, it checks to see if it is = to the past moves like thisalex_dsnews wrote:you're not drawing every pixel each refresh, are you?just dont be expecting a speed demon like squarz... at least not on the first version.
for i = 1, CurrentNumberofMoves
if x = past_x and y = past_y then
crash()
end
CurrentNumberofMoves = CurrentNumberofMoves +1
so you can see that after about 50 moves this can get slow
Try making i a local array (outside your for loop so that Lua does not assign it every loop);
local iArray = i
You should also be able to compare both variables;
if {x,y} == {past_x[iArray],past_y[iArray]} then
...
end
And finally make sure you are running this comparison once per move cycle, not once per screen refresh. Should be able to handle it... I haven't seen the code, have you posted it yet and I just missed it?
local iArray = i
You should also be able to compare both variables;
if {x,y} == {past_x[iArray],past_y[iArray]} then
...
end
And finally make sure you are running this comparison once per move cycle, not once per screen refresh. Should be able to handle it... I haven't seen the code, have you posted it yet and I just missed it?
NORT 0.1 ready for download
ok i mannaged to get the collition detection to compair line differences instead of pixle difference which means alot less comparisons, a variable is only added each time the cycles turn and not each time they move forward.. ok enyway here is the link
(V 0.2) is now available here
http://www.megaupload.com/?d=2519XVN9
if anyone wants to mirror it then by all means do so.
NORT 0.2 (2 player version only for right now)
by dragula96
version 0.2 changes/fixes
------------------------------------
-added cycles to playfield
-changed blue color line and cycle to yellow
-removed white line in the middle of cycle walls
-changed background to a nicer one
- fixed bug where some people were not able to run game(ihope)
-fixed bug that would let you go "out of bounds" at the top
known bugs in 0.2
-pressing diagnaly is NOT RECOMMENDED, and slows down the game indefinetly
-if game goes on to long then slow down will occur however i cant find anyone
to test this with so i dont know how much slowdown you will get
version 0.1 NOTES:
-----------------------------
0.1 very first release, with very basic graphics
will be updated very soon with better graphics
and eventualy computer AI
Select = screenshot so dont press it if you dont want to take a pretty picture of my awsome program
OBJECTIVE OF THE GAME
---------------------------
simple: just make the other player crash into your "wall of death" before he does it to you
watch out the side walls and you are not immune to your own walls either.
(note: the game still does not keep track of score , players will have to do this in their heads)
player 1 controls "blue racer" with D pad
player 2 controls "red racer" with buttons (triangle,square,circle,cross)
this is only a test build please let me know if any bugs are found.
[email protected]
-dragula96
(V 0.2) is now available here
http://www.megaupload.com/?d=2519XVN9
if anyone wants to mirror it then by all means do so.
NORT 0.2 (2 player version only for right now)
by dragula96
version 0.2 changes/fixes
------------------------------------
-added cycles to playfield
-changed blue color line and cycle to yellow
-removed white line in the middle of cycle walls
-changed background to a nicer one
- fixed bug where some people were not able to run game(ihope)
-fixed bug that would let you go "out of bounds" at the top
known bugs in 0.2
-pressing diagnaly is NOT RECOMMENDED, and slows down the game indefinetly
-if game goes on to long then slow down will occur however i cant find anyone
to test this with so i dont know how much slowdown you will get
version 0.1 NOTES:
-----------------------------
0.1 very first release, with very basic graphics
will be updated very soon with better graphics
and eventualy computer AI
Select = screenshot so dont press it if you dont want to take a pretty picture of my awsome program
OBJECTIVE OF THE GAME
---------------------------
simple: just make the other player crash into your "wall of death" before he does it to you
watch out the side walls and you are not immune to your own walls either.
(note: the game still does not keep track of score , players will have to do this in their heads)
player 1 controls "blue racer" with D pad
player 2 controls "red racer" with buttons (triangle,square,circle,cross)
this is only a test build please let me know if any bugs are found.
[email protected]
-dragula96
Last edited by dragula96 on Tue Aug 23, 2005 9:57 am, edited 1 time in total.
-
- Posts: 116
- Joined: Mon Jul 18, 2005 2:20 am
http://haggar.pocketheaven.com/LUAtris Beta.zip
Beta version of what I've been working on the last 2 days.
Do not post as news (if any news site ppl reads this).
If anybody finds any bugs/crashes, then tell me (and it would be nice if you also say what line of code it crashes on).
Beta version of what I've been working on the last 2 days.
Do not post as news (if any news site ppl reads this).
If anybody finds any bugs/crashes, then tell me (and it would be nice if you also say what line of code it crashes on).
Lua Player
Is a version planned to be usable with the European models?
Re: Lua Player
No. It's currently impossible to run homebrew apps on European PSPs (and all PSPs running the 2.0 firmware), and is likely to be so for a while...Sir Harvo wrote:Is a version planned to be usable with the European models?
Dpad converted to analog control..
Ok,
I have this basic control coded. It just pushes the square in the direction you input according to the dpad. I've been trying to learn how to use the analog function instead. Can someone help me convert this to analog instead of the dpad. Any help is appreciated.
Here is the code:
I have this basic control coded. It just pushes the square in the direction you input according to the dpad. I've been trying to learn how to use the analog function instead. Can someone help me convert this to analog instead of the dpad. Any help is appreciated.
Here is the code:
Code: Select all
-- Activate USB Mode
System.usbDiskModeActivate()
-- Get colors for text
white = Color.new(255, 255, 255)
red = Color.new(255, 0, 0)
-- Load images
square = Image.load("square.png")
-- Set starting X/Y positions
x = 200
y = 100
while true do
pad = Controls.read()
if pad:up() then
screen:clear()
screen:print(200,1, "You Pressed Up", white)
y = y - 5
if y < -4 then
y = -4
end
end
if pad:down() then
screen:clear()
screen:print(200,1, "You Pressed Down", white)
y = y + 5
if y > 230 then
y = 230
end
end
if pad:left() then
screen:clear()
screen:print(200,1, "You Pressed Left", white)
x = x - 5
if x < -4 then
x = -4
end
end
if pad:right() then
screen:clear()
screen:print(200,1, "You Pressed Right", white)
x = x + 5
if x > 440 then
x = 440
end
end
if pad:cross() then
screen:clear()
screen:print(200,1, "You Pressed [CROSS]", white)
end
if pad:triangle() then
screen:clear()
screen:print(200,1, "You Pressed [TRIANGLE]", white)
end
if pad:square() then
screen:clear()
screen:print(200,1, "You Pressed [SQUARE]", white)
end
if pad:circle() then
screen:clear()
screen:print(200,1, "You Pressed [CIRCLE]", white)
end
if pad:start() then
break
end
-- Draw my little square
screen:blit(x, y, square)
screen.flip()
end
I did already. I was able to use the analog, but it wasnt correct. I wasnt sure what type of x/y stuff I'd need to use. I'll go back and try and figure it out, unless someone wants to put a little hint down for me hehe.Shine wrote:Take a look at the Tutorial.
If you keep asking for help with everything, you'll never learn properly yourself. Writing an app to test the behavior of the analog stick isn't that hard, and you'll probably learn more than just the analog stick in the process.F34R wrote:I did already. I was able to use the analog, but it wasnt correct. I wasnt sure what type of x/y stuff I'd need to use. I'll go back and try and figure it out, unless someone wants to put a little hint down for me hehe.Shine wrote:Take a look at the Tutorial.
Well, I continued to think about it, and write different things down, test them, and do it over again lol. I got it all working properly.nevyn wrote:If you keep asking for help with everything, you'll never learn properly yourself. Writing an app to test the behavior of the analog stick isn't that hard, and you'll probably learn more than just the analog stick in the process.F34R wrote:I did already. I was able to use the analog, but it wasnt correct. I wasnt sure what type of x/y stuff I'd need to use. I'll go back and try and figure it out, unless someone wants to put a little hint down for me hehe.Shine wrote:Take a look at the Tutorial.
Thanks for the encouragement. I only asked for help because I was becoming very frustrated with failure. Fatigue from other things wasnt helping me think about what I wanted to accomplish, and... well, I was just very tired. I wish someone would have posted something for me to look at, but I did figure it out w/o it. So I guess its possible lol.
You were right, I learned something more than just how to implement basic movemen with the A-nub... I was able to figure out how to control its speed as well. Thanks.
Luaplayer windows controls question
Hi All,
I'm using the windows lua player to code up my app without having to copy over to the PSP all the time, but I can't get the controls to work correctly. My test program (included below) produces the following results for the following keys:
a, s, q & w all work as described ie sel, start and triggers.
But f, r, c and d don't produce the desired behaviour. Instead, e,g,d and f seem to be up, down, left and right respectively. The upshot of this is that with the exception of the triangle and cross keys (r, c), the square and circle keys (d, f) don't produce the desired results - they come out as Left and Right???
Am I missing something totally obvious here? I've been over it so many times Im worried Im missing something thats staring me in the face.
Here's an attached listing which should display some chars based on the button pressed:
I'm using the windows lua player to code up my app without having to copy over to the PSP all the time, but I can't get the controls to work correctly. My test program (included below) produces the following results for the following keys:
a, s, q & w all work as described ie sel, start and triggers.
But f, r, c and d don't produce the desired behaviour. Instead, e,g,d and f seem to be up, down, left and right respectively. The upshot of this is that with the exception of the triangle and cross keys (r, c), the square and circle keys (d, f) don't produce the desired results - they come out as Left and Right???
Am I missing something totally obvious here? I've been over it so many times Im worried Im missing something thats staring me in the face.
Here's an attached listing which should display some chars based on the button pressed:
Code: Select all
color = Color.new(0,0,0)
white = Color.new(255,255,255)
black = Color.new(0,0,0)
myctrl = ""
while 1 do
while myctrl == "" do
screen.waitVblankStart()
pad = Controls.read()
if pad:up() then
myctrl = "UP"
elseif pad:down() then
myctrl = "DN"
elseif pad:left() then
myctrl = "LF"
elseif pad:right() then
myctrl = "RG"
elseif pad:l() then
myctrl = "LS"
elseif pad:r() then
myctrl = "RS"
elseif pad:circle() then
myctrl = "CIR"
elseif pad:triangle() then
myctrl = "TRI"
elseif pad:square() then
myctrl = "SQUARE"
elseif pad:select() then
myctrl = "SEL"
elseif pad:start() then
myctrl = "START"
elseif pad:cross() then
myctrl = "X"
end
end
screen:clear(white)
screen:print(10,10,myctrl,black)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(30)
myctrl = ""
screen:clear(white)
screen.waitVblankStart()
screen.flip()
end
Re: Luaplayer windows controls question
There was a bug, will be fixed in the next release.Slopey wrote: I'm using the windows lua player to code up my app without having to copy over to the PSP all the time, but I can't get the controls to work correctly.
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am