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; no, montrob... that will work, but kills anymore possibilities of higher platforms... if using that mehtod that is... Just use ...
-
05-16-2006, 06:06 PM #2341words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
no, montrob... that will work, but kills anymore possibilities of higher platforms... if using that mehtod that is...
Just use collision, if it collides with platform, then player.y = platform.y - 2 ish
That will not have it in the platform if u have a semi off picture...
Im planning on making a new lib that is just for math functions to minimize the questions and trouble with collision and rotation

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
05-16-2006, 06:42 PM #2342Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von natan333
try this:
Code:move = Timer.new() move:stop() move:reset() if true then screen:blit(x1, y1, player2) x1 = x1 + 2 end move:start() if true and pause == true then if move:time() <= 15 then screen:blit(x0, y0, up2) end if move:time() > 15 and move:time() < 30 then screen:blit(x0, y0, up1) end if move:time() >= 30 then y0 = y0 - 2 move:reset() end if pad:up() then pause = true end
--------------------------------------------------------------------------------------
-
05-16-2006, 10:54 PM #2343is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
in terms of the gravity thing i'd say, if x > whetever and x < whatever then
if y >= the number (i think 183) then y = 183
end
endWhat did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
05-17-2006, 07:14 AM #2344QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
I'm qouting my own edit:
try it now.Code:player = {} player.gravity = 160 player.y = 230 player.x = 50 player.jumpspeed = 10 player.jumpstate = "ground" while true do pad = Controls.read() screen:clear() screen:blit(0,0,Background1) if pad:r() and oldpad:r() ~= pad:r() then bulletSetup() end if pad:left() then player.x = player.x - 2 end if pad:right() then player.x = player.x + 2 end if pad:cross() and player.jumpstate == "ground" then player.jumpstate = "jumping" end if player.jumpstate == "jumping" then player.jumpspeed = player.jumpspeed - 0.5 player.gravity = player.gravity - player.jumpspeed end if player.gravity < 0 then player.jumpstate = "falling" end if player.gravity < 160 and player.jumpstate == "falling" then player.gravity = player.gravity + (player.jumpspeed + 3) end if player.gravity == 160 then player.jumpspeed = 10 player.jumpstate = "ground" end if player.gravity > 160 then player.gravity = 160 end player.y = player.gravity screen:blit(player.x,player.y,player1) screen:blit(0,0,ground) second_floor = {} second_floor.y = 220 -- made it lower, just in case the player cant reach. second_floor.x1 = 100 second_floor.x2 = 200 if player.y <= second_floor.y and player.x >= second_floor.x1 and player.x <= second_floor.x2 then player.y = second_floor.y -- I forgot the ".y" last time. end
i made two changes from the last time, one correcting a stupid mistake on my part.[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-17-2006, 12:40 PM #2345QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Whats the biggest file u can play in homebrew games?
<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
05-17-2006, 02:52 PM #2346
Zitat von Grimfate126
thx very much
my code now is
and it works like a charm :Jump:Code:if pad:up() then move:start() y0 = y0 - 2 screen:blit(x0, y0, up1) end if pad:up() and move:time() > 0 then screen:blit(x0, y0, up2) end if pad:up() and move:time() > 150 then screen:blit(x0, y0, up1) end if pad:up() and move:time() > 300 then move:reset() end
but ... the picture is buggy
it dosent move the same as if its stopped
like: There is a guy, if i move it up, some of his picture will mess up and goes down a little.
if i press down, his foot get messtup and it goes up inside his body (so it disapear)
is this is what supposed to happend or is there a code to fix it ?Geändert von natan333 (05-17-2006 um 02:55 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
05-17-2006, 02:53 PM #2347
depends on what language you're coding it in. If its in LUA it depends on what kind of file aswell. In C I dont know but i think as long as it doesn't exceed the PSP's memory it'll work, but I dont know that, its just a guess.
LUA manual:
[url]http://www.lua.org/manual/5.0/manual.html[/url]
LUA Wiki:
[url]http://wiki.ps2dev.org/psp:lua_player[/url]
-
05-17-2006, 03:09 PM #2348
this is the code is to tell what i mean
when up1 is going up, it will be different from going down.Code:black = Color.new(0,0,0) up1 = Image.load("DotValley/up1.png") player1 = Image.load("DotValley/player1.png") x0 = 140 y0 = 150 while true do screen:clear(black) pad = Controls.read() --- screen:blit(x0, y0, player1) ------------------ if pad:up() then y0 = y0 - 2 screen:blit(x0, y0, up1) end --- if pad:down() then y0 = y0 + 2 screen:blit(x0, y0, up1) end ------------------ if pad:select() then break end --- screen.waitVblankStart() screen:flip() end
or is there a code that i have to add to correct it ?Geändert von natan333 (05-17-2006 um 03:12 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
05-17-2006, 03:12 PM #2349QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
natan333, I am not sure if you should have screen:blit everytime you press up or down. I think because screen:blit(x0,y0,image) is under while true do, it will update the x0 and the y0. Just a guess. So it would be up and donw just without the screen:blit.
-
05-17-2006, 03:18 PM #2350
hmm well, i toke out both "screen:blit(x0, y0, up1)"
and left out with "screen:blit(x0, y0, player1)" only and it does the same thing
Geändert von natan333 (05-17-2006 um 03:20 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
05-17-2006, 04:46 PM #2351<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
Try This
Zitat von natan333
Code:black = Color.new(0,0,0) up1 = Image.load("DotValley/up1.png") player1 = Image.load("DotValley/player1.png") x0 = 140 y0 = 150 while true do screen:clear(black) pad = Controls.read() --- screen:blit(x0, y0, player1) screen:blit(x0, y0, up1) ------------------ if pad:up() then y0 = y0 - 2 end --- if pad:down() then y0 = y0 + 2 end ------------------ if pad:select() then break end --- screen.waitVblankStart() screen:flip() end
-
05-17-2006, 04:50 PM #2352QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
??
Zitat von Sousanator
Wont that just make the "up1" image blit right on the "player1" image and never leave?[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-17-2006, 04:55 PM #2353<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
oops,, i didnt read the problem right,,
what is up sopposed to be?
is it like him jumping?
-
05-17-2006, 04:59 PM #2354QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
yep.
Zitat von Sousanator
but other than that, I dont fully get what it is he's trying to do.
He said something about wanting it to appear different when going down then from when its jumping.
(I'm guess, he wants to make it look like the player is falling, in which case, all need do is make a new image that looks like its falling, and blit it when you press down.)[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-17-2006, 05:09 PM #2355<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
for that i would use a timer
(this is what I did in Serve N Go)
this is also a 2 animation job
Code:if Animation:time() >= 200 then Animation:reset(0) Animation:stop() end if pad:up() then Animation:start() Direction = 1 playery = playery - 8 end if pad:down() then Animation:start() Direction = 2 playery = playery + 8 end if Animation:time() > 100 and Direction == 2 then screen:blit(x, y, up2) elseif Direction == 2 then screen:blit(x, y, up1) end if Animation:time() > 100 and Direction == 2 then screen:blit(x, y, down2) elseif Direction == 1 then screen:blit(x, y, down1) end
-
05-17-2006, 05:53 PM #2356
hmm, you guys dint get it
it must be my pc and psp then
this is the picture "player1"

i put this picture to make it go up or down if i press the button.
the picture colors dont move correctly (they kinda get blurr and mix a little while moving)
some of the color get darker while moving
also noticed that you can see the colors not right in black screen and in white screen a littleGeändert von natan333 (05-17-2006 um 06:10 PM Uhr)
Bequiet!!!
I'm learning cc©cc
-
05-18-2006, 08:15 AM #2357QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
What is the largest mp3/wav file the luaplayer can play in a game?
<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
05-18-2006, 08:40 AM #2358QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
dont know..cant help you, sorry.
Zitat von natan333
[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
05-18-2006, 09:35 AM #2359Developer

- Registriert seit
- Oct 2005
- Ort
- Boston, MA
- Beiträge
- 1.389
- Points
- 14.378
- Level
- 77
- Downloads
- 0
- Uploads
- 0
MP3 isnt playable
Zitat von JoeDaStudd
i think a WAV of 30secs MAX
-
05-18-2006, 09:54 AM #2360QJ Gamer Bronze
- Registriert seit
- Feb 2006
- Ort
- Earth, UK
- Beiträge
- 457
- Points
- 5.924
- Level
- 49
- Downloads
- 0
- Uploads
- 0
k, thank i thought it might be something like that
<<Put A message Here>>
<<Just made another rubbish website visit it here.>>
-
05-18-2006, 12:23 PM #2361QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
I have a question: How would you do something every time a timer increases by 10? So when the timer is 10 or 20 or 30 or 40, and only THOSE numbers that are evenly divisble by 10, something happens. Thank you for the help :icon_smil and i hope I didn't make it too :icon_sad: complicated. Sometimes I tend to over explain things.
-
05-18-2006, 02:13 PM #2362QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
a loop like so:
for i = 1,4 do
if timer == 10 * i then
code
end
end1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
05-18-2006, 02:14 PM #2363QJ Gamer Gold
- Registriert seit
- Mar 2006
- Ort
- LOLWUT
- Beiträge
- 2.625
- Points
- 18.627
- Level
- 86
- Downloads
- 0
- Uploads
- 0
THANK you so much. This will help me with a game that I am not making. :) I just wanted to know. Although, I might try to create a game with that.
Zitat von slicer4ever
EDIT: how many milliseconds are in one second? I'm pretty sure it's not a million.Geändert von PSPduh (05-18-2006 um 02:26 PM Uhr)
-
05-18-2006, 02:26 PM #2364QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
no prob loops can come in handy=-)
@ your edit 1001. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
05-18-2006, 05:05 PM #2365
Yea, the prefix milli - means times (10 ^ -3)
Zitat von PSPduh
so there are 0.001 seconds in a millisecond i quess.
-
05-18-2006, 05:06 PM #2366
Hey can anyone help me with clearing an image on the screen, yet not the whole screen? Here is my code:
person = Image.load("player.png")
while true do
screen:blit(10,10, person)
pad = Controls.read()
if pad:cross() then
screen:clear(person)
screen.flip()
break
end
screen.flip()
end
screen.waitVblankStart(10 0)
-
05-18-2006, 05:11 PM #2367QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
what's wrong? what error are you getting?
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
05-18-2006, 05:38 PM #2368
can you read:
Hey can anyone help me with clearing an image on the screen, yet not the whole screenFree Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
05-18-2006, 05:52 PM #2369Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
hi guys, i have a question. i am loading like 18 high detail images, form a standalone LUA eboot. when i run it on luaplayer WINDOWS, it work awesome, when i try it on the psp, it can load more than nine images.it gives me an error. i have luaplayer .18
pls help me..--------------------------------------------------------------------------------------
-
05-18-2006, 08:17 PM #2370Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
sorry for double post, but have a prob.
i tried to do this:
but it says this:Code:for c = 1, 18 do desert..c = Image.load("sp/desert"..c..".png") end
Error: "=" expedcted near ".."
i know its not the image loading part. so what is worng??--------------------------------------------------------------------------------------


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