![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Help In Lua within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ok. this has been holding off a few of my projects. can sumone write a simple tutorial/damn good explination of ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() ![]() Tha Sigerator
|
ok. this has been holding off a few of my projects. can sumone write a simple tutorial/damn good explination of how to do sprites in lua.
for example. when i press right i want it to show the runnin animation without images screen bliting OVER each other.
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
#3 |
|
QJ Is Cluttered.
|
http://www.lua.org/manual/5.0/ should be in there somewhere
|
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
Sprites? Like assign a sprite to a character? I could help...
|
|
|
|
#5 | |
![]() ![]() Tha Sigerator
|
Quote:
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
|
#6 | |
|
QJ Is Cluttered.
|
Quote:
|
|
|
|
|
|
|
#7 | |
![]() |
Quote:
its really not that hard, just putting an array of pointers, and just changing the x value changes the frame
__________________
[IMG]http://img121.imageshack.us/img121/3852/untitled1copy7rf.png[/IMG] [IMG]http://img99.imageshack.us/img99/9711/newavatarjb9.gif[/IMG] [URL=http://forums.qj.net/showthread.php?t=9733][COLOR=DarkRed]Operation Positive Posting[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=49762][COLOR=Red]Guide to All Guides[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=13798][COLOR=Blue]Posting Guidelines[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=4394][COLOR=Green]Piracy Policy[/COLOR][/URL] [SIZE="3"][URL=http://forums.qj.net/f-general-psp-help-22/t-guide-opening-psp-disassembly-assembly-video-104303.html][COLOR=Red][B][U]PSP Disassembly Assembly Video Tutorial[/U][/B][/COLOR][/URL][/SIZE] |
|
|
|
|
|
|
#8 |
![]() ![]() total-Z
|
Here is how animations work...
Well, you use a timer object and say that if timer >= [time] then blit [sprite] Then you say if timer > maxtime then timer:reset() EXAMPLE: sprite1 = Image.load("blah") sprite2 = Image.load("blah") sprite3 = Image.load("blah") timer1 = Timer.new() timer1:reset(0) while true do screen:clear() if timer1:time() >= 3000 then timer1:reset(0) timer1:start() end if timer1:time() >= 2000 then screen:blit(0,0,sprite3) elseif timer1:time() >= 1000 then screen:blit(0,0,sprite2) else screen:blit(0,0,sprite1) end screen.waitVblankStart() screen.flip() end Note that I havent tested this, I just typed it up.
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
#9 | |
![]() ![]() total-Z
|
Quote:
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#10 |
![]() |
he wants more like
sprite[1] = Image.load("blah") sprite[2] = Image.load("blah") sprite[3] = Image.load("blah") x = 1 while true do x = x + 1 screen:blit(0,0,sprite[x]) if x == 3 then x = 1 end screen.waitVblankStart(de lay between each frame) screen.flip() end
__________________
[IMG]http://img121.imageshack.us/img121/3852/untitled1copy7rf.png[/IMG] [IMG]http://img99.imageshack.us/img99/9711/newavatarjb9.gif[/IMG] [URL=http://forums.qj.net/showthread.php?t=9733][COLOR=DarkRed]Operation Positive Posting[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=49762][COLOR=Red]Guide to All Guides[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=13798][COLOR=Blue]Posting Guidelines[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=4394][COLOR=Green]Piracy Policy[/COLOR][/URL] [SIZE="3"][URL=http://forums.qj.net/f-general-psp-help-22/t-guide-opening-psp-disassembly-assembly-video-104303.html][COLOR=Red][B][U]PSP Disassembly Assembly Video Tutorial[/U][/B][/COLOR][/URL][/SIZE] |
|
|
|
|
|
#11 | ||
![]() ![]() Tha Sigerator
|
Quote:
![]() Quote:
edit: AWW CRAP I THINK I GOT IT but now i g2 test
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
||
|
|
|
|
|
#12 | |
|
QJ Is Cluttered.
|
Quote:
sorry my bad, is there any good documentation anywhere about this?
|
|
|
|
|
|
|
#13 | |
![]() ![]() total-Z
|
Quote:
To about 3 or 4 posts up, using a variable is a BAD idea because if your program is taking its sweet time, it will make the delay between animations different. With timers running in the background, it is as accurate as possible.
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#14 |
![]() |
i just wrote that up in a couple of seconds
__________________
[IMG]http://img121.imageshack.us/img121/3852/untitled1copy7rf.png[/IMG] [IMG]http://img99.imageshack.us/img99/9711/newavatarjb9.gif[/IMG] [URL=http://forums.qj.net/showthread.php?t=9733][COLOR=DarkRed]Operation Positive Posting[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=49762][COLOR=Red]Guide to All Guides[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=13798][COLOR=Blue]Posting Guidelines[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=4394][COLOR=Green]Piracy Policy[/COLOR][/URL] [SIZE="3"][URL=http://forums.qj.net/f-general-psp-help-22/t-guide-opening-psp-disassembly-assembly-video-104303.html][COLOR=Red][B][U]PSP Disassembly Assembly Video Tutorial[/U][/B][/COLOR][/URL][/SIZE] |
|
|
|
|
|
#15 | |
![]() ![]() total-Z
|
Quote:
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
|
#16 |
![]() |
true, but i didnt want to think that much
but using the pointer array is probably what he wants just change using a variable to using a timer and that should work better
__________________
[IMG]http://img121.imageshack.us/img121/3852/untitled1copy7rf.png[/IMG] [IMG]http://img99.imageshack.us/img99/9711/newavatarjb9.gif[/IMG] [URL=http://forums.qj.net/showthread.php?t=9733][COLOR=DarkRed]Operation Positive Posting[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=49762][COLOR=Red]Guide to All Guides[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=13798][COLOR=Blue]Posting Guidelines[/COLOR][/URL] [URL=http://forums.qj.net/showthread.php?t=4394][COLOR=Green]Piracy Policy[/COLOR][/URL] [SIZE="3"][URL=http://forums.qj.net/f-general-psp-help-22/t-guide-opening-psp-disassembly-assembly-video-104303.html][COLOR=Red][B][U]PSP Disassembly Assembly Video Tutorial[/U][/B][/COLOR][/URL][/SIZE] |
|
|
|
|
|
#17 |
![]() ![]() Tha Sigerator
|
ok got a prob.
attempt to index global 'sprite' (a nil value) heres the source Code:
sprite[1] = Image.load("pics/sprite1.png")
sprite[2] = Image.load("pics/sprite2.png")
sprite[3] = Image.load("pics/sprite3.png")
x = 1
while true do
x = x + 1
screen:blit(0,0,sprite[x])
if x == 3 then
x = 1
end
screen.waitVblankStart(0)
screen.flip()
end
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
#18 |
![]() ![]() noob |
Yeah, is there a tutorial on moving sprites, jumping, shooting, etc.? I really want to start working on a sidescrolling, platforming, shooting game? The tutorials I've read haven't given me much clue on this... so what are some good tutorials, or lua scripts to look at if I want to start learning this type of coding in Lua?
|
|
|
|
|
|
#19 | |
![]() ![]() Tha Sigerator
|
Quote:
i think it has sumthing to do with Code:
screen:blit(0,0,sprite[x])
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
|
#20 | |
|
Guest
Posts: n/a
|
Quote:
Not sure if you can use a variable... |
|
|
|
|
#21 |
![]() ![]() Tha Sigerator
|
looks like u can't even use "[]" in the image load.!!!!1
guess someone else gotta show a sample
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
#22 |
![]() ![]() total-Z
|
Dude
sprite = {} you need to DEFINE it first!! And, yeah, you CAN use a variable, but dont make it change the sprite EVERY frame. (The PSP gets 60 fps)
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
#23 |
![]() ![]() Tha Sigerator
|
ok my brain hurts lol. i need to sleep BYE
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
|
|
#24 |
![]() ![]() Cool Developer
|
Lol, can anyone help, i need to know how to rename a directory on the memory stick using lua code...
Like "ms0:/FIRST" renamed to "ms0:/SECOND" but retaining the files... Is this possible?
__________________
Hmm... |
|
|
|
|
|
#25 | |
![]() ![]() Gutya
|
Quote:
__________________
D:
|
|
|
|
|
|
|
#27 | |
![]() ![]() Is in your zone.
|
Quote:
__________________
![]() --XBL Gamertag: PhenoM904-- |
|
|
|
|
|
|
#28 |
![]() ![]() total-Z
|
xigency, before you tell the program what sprite[1] and sprite[2] is, you first need to say what sprite is.
sprite = {} that means that sprite is a table. now you may start loading the images into the table. make sense?
__________________
牧来栠摩琠敨映汩獥PSN: youresam From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth |
|
|
|
|
|
#29 |
![]() ![]() Tha Sigerator
|
umm...can sumone jus write a sample code
__________________
- - - - Somewhere Lurking in THA SHADOWS - - - -
|
|
|
|
![]() |
| Tags |
| lua |
| Thread Tools | |
|
|