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; LuaPlayer print text function doesn't support linebreaks. No other reason really....
-
04-06-2007, 03:10 AM #6541QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
LuaPlayer print text function doesn't support linebreaks. No other reason really.
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
04-06-2007, 03:41 AM #6542
I have a image with a player on it and I was able to get it on the screen and move it. My problem is that I don't know how to remove the background from the player image (blue).
-
04-06-2007, 03:44 AM #6543QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- Tokoroa, New Zealand
- Beiträge
- 103
- Points
- 4.412
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Well if this is true, then how will you print half of a string on one line and half on the next? Man this is starting to frustrate me. And if Lua does not support this, why is it included in the lua dev kit snippets?
Zitat von yaustar
-
04-06-2007, 03:46 AM #6544Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
remove the line that says clear:image blue or something like that. I havent done lua in a while.
romulator move onto C OR C++ if you are getting frustrated.
-
04-06-2007, 03:49 AM #6545
Make a .png with a alpha channel. The easiest way i can think of is making the image in photoshop with no color/transparent as background and saving as a .png. If you are using paint though you have no way of adding transparency. .png transparency is very useful too, you can get not only full transparency but also anything between 1~99% too.
Zitat von sony psp player
My only gripe about the lua transparency support is that when you blit a image with transparency onto another image you will lose all transparency. What made it worse is that you can't create an image with transparency by script (easily and resource freindly).
-
04-06-2007, 03:53 AM #6546
Can I add transperency with the gimp?
-
04-06-2007, 03:54 AM #6547QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Lua's default print function that prints to the console supports line breaks. LuaPlayer print to screen function that prints to the screen doesn't.
Zitat von romulator
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
04-06-2007, 04:34 AM #6548QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- Tokoroa, New Zealand
- Beiträge
- 103
- Points
- 4.412
- Level
- 42
- Downloads
- 0
- Uploads
- 0
How can I use the default functions that print to the console or am I stuck to figure out a way on my own? (It's 12:33 am so I'm very tired). Thanks for your help anyway yaustar if you can't figure this out.
-
04-06-2007, 04:37 AM #6549Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
I only knew about the screen:Print function when i used lua. Never knew of another way ...
Yaustar would it be easier for me to go to C if i plan on using the gu because i have something lined up now.
-
04-06-2007, 04:46 AM #6550QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
print("text")
Zitat von romulator
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
04-06-2007, 04:56 AM #6551QJ Gamer Blue
- Registriert seit
- Jun 2006
- Ort
- Tokoroa, New Zealand
- Beiträge
- 103
- Points
- 4.412
- Level
- 42
- Downloads
- 0
- Uploads
- 0
Ummm I tried that and that didn't help. Unless you could explain further, I won't be able to do it.
-
04-06-2007, 05:01 AM #6552Developer

- Registriert seit
- Jul 2006
- Beiträge
- 205
- Points
- 4.318
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Assuming you've got the image saved as a png:
Zitat von sony psp player
Go to Select>By Color
Click on your background (make sure your background is a color not used anywhere else on your sprite)
Go to Layer>Transparency>Color to Alpha
Choose your background color by clicking on the color box
Click OK.
If that transparency option is greyed out, there should be one that isn't, which is Add Alpha Channel. Guess what that does.
This is sort of what the Lua Code Challenge 3 was on Evilmana.com:
Zitat von romulator
http://forums.evilmana.com/index.php?topic=601.15
Have a look at the last post (#20), you can use whatever you need from it, if you like. I believe I commented it pretty well.
-
04-06-2007, 05:27 AM #6553
ok, i have this really simple jump theory, here is the code with the animation and the problem is that it doesn't come back down when prompted to
also, when the animatin stops, it won't clear the scrren and replaye it with player.img, even with the running animationCode:standright = Image.load("images/jack/jackstandright.png") jump = Image.load("images/jack/jackjumpright1.png") jump2 = Image.load("images/jack/jackjumpright2.png") jump3 = Image.load("images/jack/jackjumpright3.png") player = {} player.x = 20 player.y = 200 player.img = standright Timer1 = 0 function jumpright() Timer1 = Timer1 + 1 if Timer1==5 then player.img = jump end if Timer1==10 then player.img = jump2 end if Timer1==15 then player.img = jump3 end while true do ----MAIN LOOP---- oldx = player.x oldy = player.y screen:clear() pad = Controls.read() if pad:up() then jumpright() player.y = player.y + 10 --player y is 20 so if you add it it will go 30 end if pad:up() and player.y == 30 then --since player y is 30 because of the last loop, i want it to come back down to 20 player.y = player.y + 10 end screen:blit(player.x, player.y, player.img) screen.flip() oldpad = pad screen.waitVblankStart() end
-
04-06-2007, 06:11 AM #6554Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
the function is only being called one time, specifically when the button is pressed. No button, no function. Try using a flag like player.jumping = true and have a function run while that flag is true and not run when it is false.
-
04-06-2007, 06:27 AM #6555Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
you should give animlib a try. (unless you already have).
Zitat von moncristo_da_dev
--------------------------------------------------------------------------------------
-
04-06-2007, 07:35 AM #6556
Now I have a image with an alpha channel. How do I use it in lua?
This is my code, but it doesn't work:
screen:blit(movey, movex, player, alpha = true)
-
04-06-2007, 08:02 AM #6557QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
The short answer is that you write your function that parses the string for line breaks and prints the text in the right positions.
Zitat von romulator
-= Double Post =-
It be easier in some ways and harder in others. In short, I honestly don't know. You still have to face the same challenges but the difference is that it be in a different language.
Zitat von eldiablov
If it was me, I would just use an existing engine (eg LTE) rather then re-inventing the wheel.Geändert von yaustar (04-06-2007 um 08:05 AM Uhr) Grund: Automerged Doublepost
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
04-06-2007, 08:22 AM #6558QJ Gamer Green
- Registriert seit
- Nov 2005
- Ort
- Sweden
- Beiträge
- 460
- Points
- 6.520
- Level
- 52
- Downloads
- 0
- Uploads
- 0
The alpha is true as default in the image:blit() function, you don't need to type true or false.
Zitat von sony psp player
The red area is the error, why you saw 'alpha = true' in the LUA function page is because they were stating to the user that it represents the boolean of the alpha to the blitting.Code:screen:blit(movey, movex, player, alpha = true)
But as i said it's default, so you don't need it.Code:screen:blit(movey, movex, player, true)
Geändert von HaxxBlaster (04-06-2007 um 09:14 AM Uhr)
[CENTER]Some of my homebrew Applications/Games:
[URL=http://forums.qj.net/showthread.php?t=47294&page=1&pp=10]Planet Fighter[/URL] | [URL=http://forums.qj.net/showthread.php?p=641672#post641672]Graphic Creator (V2.0)[/URL] | [URL=http://forums.qj.net/showthread.php?p=512717]Fire Pong[/URL] | [B][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html#post1430891"][COLOR="Red"][SIZE="3"]Brushes v2.0[/COLOR][/SIZE][/B][/URL] [URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][B][SIZE="2"][COLOR="Black"]Released![/COLOR][/SIZE][/B][/URL]
[URL="http://haxxblaster.2u.se/"][COLOR="black"][FONT="Arial Black"]www.HaxxBlaster.com[/FONT][/COLOR][/URL]
[URL="http://forums.qj.net/f-psp-development-forum-11/t-release-brushes-v20-99207.html"][IMG]http://img19.imageshack.us/img19/1346/brushesbannerqz3.png[/IMG][/URL][/CENTER]
-
04-06-2007, 09:03 AM #6559
Thanks!
-
04-06-2007, 12:00 PM #6560
i don't want to put that big code in the beginning, i just want to blit and play a sprite animation, so can you give me the code simplified for that?
Zitat von Grimfate126
-
04-06-2007, 12:39 PM #6561Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
big code ???!!!
dofile("animlib.lua")
If that's big to you then you must be an extremely tiny person.
or just have a really tiny computer
-
04-06-2007, 02:58 PM #6562QJ Gamer Gold
- Registriert seit
- Aug 2006
- Ort
- Under Your Bed
- Beiträge
- 3.083
- Points
- 12.189
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Is it possible
Is it possible to run an EBOOT using lua
-
04-06-2007, 03:00 PM #6563
....NO
Zitat von xpack
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-06-2007, 03:00 PM #6564QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
^^ what he said
-
04-06-2007, 03:56 PM #6565
can someone give me an explanation of Gum.perspective?
Gum.perspective(50, 16/9, 0.5, 1000)
I know that the 16/9 is for the aspect ratio of the psp's screen, but what are the other 3 numbers for?
-
04-06-2007, 03:59 PM #6566QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
In order:
Field of View (FoV)
Aspect ratio
Near clipping plane
Far clipping plane
http://fly.cc.fer.hr/~unreal/theredbook/chapter03.html
About halfway down the page.[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
04-06-2007, 03:59 PM #6567QJ Gamer Gold
- Registriert seit
- Nov 2006
- Ort
- ...
- Beiträge
- 2.080
- Points
- 11.942
- Level
- 71
- Downloads
- 0
- Uploads
- 0
the 50 is i think like the field
and .5 is like how close the cam can be, and the 1000 is how far it could be
-
04-06-2007, 04:02 PM #6568QJ Gamer Gold
- Registriert seit
- Aug 2006
- Beiträge
- 1.633
- Points
- 11.629
- Level
- 70
- Downloads
- 0
- Uploads
- 0
50 is field of view aka how much canm be seen 0.5 is how close something can get before being clipped and 1000 is how far it can get before being clipped.
-
04-06-2007, 04:20 PM #6569
field of view - how does that work exactly?
-
04-06-2007, 04:22 PM #6570QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
FOV is how many degree you want the field of vision to be. It is usually in degrees.
http://fly.cc.fer.hr/~unreal/theredb...es/Fig3-12.gif[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]


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