-
right i have a nother question for you not so noobish ppl.. say i have four images.. and i want them to be displayed randomly (random order , not for a random time..) if someone could please guide me in the right direction.. i would be grateful.. or perhaps if someone has a link to a tutorial that deals with randomness, as no of the ones i've studied didn't mention the topic..
CHEERS!! :)
P.S. apologies for these probably stupid questions.. but i want to know and my current tutoriaals don't answer half my questions!! :Argh:
-
Get a number from 1 to 4 with "imagenumber=math.random( 1,4)". Then if imagenumber=1, blit image 1, if imagenumber=2, blit image 2, etc.
You can do this with a table, where you use "imagenumber" as the index: screen:blit(x,y,image[imagenumber])
OR you could use if statements: if imagenumber==1 then screen:blit(x,y,image1)
These are just examples of how this could be done. I would use the table since it's less coding.
-
:) ok i think i follow that. i'll give it a go!
thanks for helping me out :)
Double Post Merge
i'm still havin problems with it.. please tell me what's wrong with this::
--start of code
image1 = Image.load("emright.png")
image2 = Image.load("emleft.png")
image3 = Image.load("emup.png")
image4 = Image.load("emdown.png")
imagenumber=math.random(1 ,4)
screen:blit(0, 0, image[imagenumber])
screen:flip()
screen.waitVblankStart(24 0)
--end of code
i'm guessing i've forgotten somethin crucial that skipped my mind...
excuse the weird spacings
-
Zitat:
Zitat von DtotheK
Code:
--start of code
image1 = Image.load("emright.png")
image2 = Image.load("emleft.png")
image3 = Image.load("emup.png")
image4 = Image.load("emdown.png")
imagenumber=math.random(1 ,4)
screen:blit(0, 0, image[imagenumber])
screen:flip()
screen.waitVblankStart(240)
--end of code
Change it to this
Code:
image={}
image[1] = Image.load("emright.png")
image[2] = Image.load("emleft.png")
image[3] = Image.load("emup.png")
image[4] = Image.load("emdown.png")
imagenumber=math.random(1 ,4)
while true do
screen:blit(0, 0, image[imagenumber])
screen.waitVblankStart()
screen:flip()
now you should have a different pic each time you load the program
-
thanks JoeDaStudd
i get why you have it as image[2] = Image.load.......
but what does the image = {} at the very start do
-
i starts a table under the name 'image'.
Double Post Merge
DtotheK have you tried using EvilMana's tutorials, they explain everything really well and cover quite a lot.
-
No, i just googled for his and found his site, so i'll take a look. thanks for tellin be bout 'em!
PS what you said worked, thanks again .
well at first it didn't and after a few minutes i realised i deleted the eboot in the %-less folder! :ROFL:
-
Question Time!!!!!!!
I got my orbs working 100% perfectly with a tile map and dynamic collision detection! but it isn't as fast as i'd like it to be.
1. How come if I load the .lua using File Assistant++ it goes way faster and smoother then if I use luaplayer .20? if it's because of overclocking then i'm going to install that luaplayer mod thing that just came out.
2.How do you create a standalone lua app? I tried by editing the system.lua and it works...but...ehh not as nice as i'd like it to work. it's still slow and it comes up as luaplayer .20 and yeah i'd likeit to have its own icon, name, background image, and run smoother.
3. what can I use to edit the luaplayer.20 icon, name, and background?
4. why can't I use an image that is larger then 480x272? It's a strip animation if you're wondering, and i'm not displaying any more then 56x56 of it at a time.
5. How do I get my game into dl.qj.net and make a headline that people can jump?
ps: if anyone would like to see my game, just ask i'll upload it.
-
1 to 4 im not sure about
5) just make a new topic in the 'psp development' titled [NEW RELEASE] your games name then in the post have a link to its download. People will normally add them to the site in a few hours
-
to mako
2.How do you create a standalone lua app?
hopefully my answer is not gonna make me look like an ass!!
what i do is get someone elses stand alone lua app(such as shootout etc etc) then delete everything in the two folders ( % and non %) EXCEPT for the two eboots. then put your script files and pics etc in the non % folder. to change the appearence of the app in the XMB menu, such as the backround pic and music etc, get PBP unpacker and unpack the eboot in the % folder, and you can stick all your own pictures and music etc in to the new eboot you save, and put that eboot into the %folder instead of the shootout(for eg) one
i guess that last part might answer question 3 aswell. just use PBP unpacker
Note : i think shootout uses luaplayer v.14 so if you do it with another game that has .20 . Or maybe if you replace the eboot that's in the non-% folder with the eboot that's in the luaplayer v .20 non-%folder... it might work, i dunno