how do i disable the home button? i dont want that "do you want to quit the game?" screen to come up. i want nothing to happen when you push home. is it possible to do this in lua?
Printable View
how do i disable the home button? i dont want that "do you want to quit the game?" screen to come up. i want nothing to happen when you push home. is it possible to do this in lua?
Nope, the main system overrides anything lua tells it to do. You can use the home button but the home screen will still come up.
ah damn :(
Just do if pad:home() then os.exit() end
thanks, but ive already tried that, it makes the psp freeze in some weird way at the "do you want to quit this game?" screenZitat:
Zitat von -TacticalPaper-
ok then get the luaplayer mod and use System.quit()
I really dont like the way it exits, Cause if os.exit does not work, The you have to use systemquit but not everyone has the LUA Mod by cools, So i just put a break
But that doesnt work with home.
Well, Then everyone should just get the LUA Player mod and then we can use systemquit!
Allright, ball moves at the start now, but when it hits the bat's, it just moves through them, and when it hits the end of the room, (which is, when its about to move out of the PSP screen) THEN it bounces away.
There must be something wrong with the collosion, here is the edited script:
Zitat:
white = Color.new(255, 255, 255)
screen:print(136, 136, "Loading LUA Pong...", white)
screen.flip()
background = Image.load("Background.pn g")
bat1 = { x = 20, y = 100, }--Put the images in tables
bat2 = { x = 460, y = 100, }
ball = { x = 240, y = 146, mx = 1, my = 0 }--Put ball's image in it's table
--MX and MY are movemenyx and movementy. Start off mx at 1
screen.waitVblankStart(60 )
ball2 = Image.load("Ball.png")
bat11 = Image.load("bat1.png")
bat21 = Image.load("bat2.png")
while true do
screen:clear()
pad = Controls.read()
screen:blit(bat1.x, bat1.y, bat11, true)
screen:blit(bat2.x, bat2.y, bat21, true)
screen:blit(ball.x, ball.y, ball2, true)
--theres collision for bat1 now for bat 2
if ball.x == bat1.x and ball.y >= bat1.y and ball.x < (16*64) then
ball.mx = -ball.mx
end
--theres paddle 2's collision
if ball.x == bat2.x and ball.y >= bat2.y and ball.x < (16*64) then
ball.mx = -ball.mx --That should make it opposite of ball.mx, making it change directions.
end
--with ballmoving you had the idea but you need more
ball.x = ball.x + ball.mx --This makes the ball move to the right when ball.mx is positive, to the left when its negative.
--Then you can add some stuff dealing with my later. For making it move up//down, do something like
--ball.y = ball.y-ball.my
if pad:down() then
bat1.y = bat1.y +2
end
if pad:up() then
bat1.y = bat1.y -2
end
if pad:cross() then
bat2.y = bat2.y +2
end
if pad:triangle() then
bat2.y = bat2.y -2
end
if pad:start() then
break
end
screen:print(136, 136, "Welcome to the world of PPP.", white)
screen.waitVblankStart()
screen.flip()
end
Bad check. If the ball is moving 3 pxs per frame in the X direction, how can you guarantee that the ball's X and bat's X will be in the exact same postion?Code:ball.x == bat2.x
Is it possible to drop the decimal in a number? Cause I can't seem to find any distinction between an integer and a double in LUA.
Use the math library's floor or ceil function. It basically rounds down or up respectively.
http://lua-users.org/wiki/MathLibraryTutorial
You won't be able to tell the difference between an image, sound, integer, double, float, string, characters etc in Lua. It is just the way all scripting languages are for them to work as scripting languages.
Ok, I got it now, thanks! :)
Does anyone know how to view an entire text file in lua. I know its possible because fosk and them have done it but i dont want to take any of thier code so does anyone know a tutorial that explains how to open text files and view them in lua?
This is how you will view the entire txt file.Code:y = 10
file = io.open("testRead.txt","r")
for line in file:lines() do
y = y + 10
screen:print(100,y,line,white)
end
file:close()
You must declare the color "white"(You can use other colors too.)
Good job copying a snippet from evilmana :tup:
BTW that one has no scrolling.
... I guess im bothering you Tactical, maybe ill just wait for EminentJonFrost or eldiablov...
I'm just so sad... this is the first game i've ever made, (Exept if you count my windows clone on PC) so its not that i cant wait, its just that i h8 my self because i dont know a 0.000000001 part of lua. (Allright, maybe more) but still...
Whitehawk's tut didn't help a lot, only a little, and after the tut, it says:
"Congratulations, you are now a developer!"
|
|
Yeah right, i leaned how to blit an image, to write text on screen, and to play a sound. Thats great.
Actually you just arent quite being clear. What do you need help in right now? Also I recommend the tuts over at evilmana to learn more if youd like.
Evilmana is noob friendly but it is so tempting to copy from
Those tuts are great and I actually really understand the concepts that he presents. I read every tut twice and now I have grasped lua a lot beter than I have before.
i'm reading as you speak. This lesson is so boring. Business studies is NOT worth picking believe me
Allright, ill try them. What, just evilmana.com?
=D
yep thats the right address gameo. It'll help you become more independent. hows the game coming along ?
Zitat:
Zitat von gameo
You missed my post.Zitat:
Zitat von head_54us
Oh. *Chuckles a bit of anger to myself.* **Freak'in smashes the table**
That'll be corrected.
And i hope evilmana will help me.
And to you eldiablov:
Bat movement=100%
Gfx=85-100%
Ball movement=30%, appearently, but i will correct the error thanks to
head 54us.
Ball collosion= ??% Ball only colloses (is that a word?) partially when it hits the bats.
kk good to hear. And the word is collides
No actually, i might start on something else...Zitat:
Zitat von eldiablov
Here is a 2 reasons why:
1: I can't figure the out how the (beep) with the collosion, i just read it at evilmana, maybe im just too young to understand it.
2: So many people start out with ping pong, i h8 to be a part everyone, like i dont like fasion, for example, i dont care if people think my clothes is ugly, if i think its good to wear, then i will.
1. It is bascially box collision. It might be easier if you find an article on box collision in your native language
2. Finish it at least. You are just doing this for learning rather then for a release.
Answer to 1: My native language is Danish. I highly doubt there is one, because, as i've seen about only 0.0004% of the danish people know about custom fw, homebrew and other stuff.
Seriously, i was leaded to QJ through bemanistyle.com, where some people talked about PSPR.
Answer to 2: I didn't say im not gonna finish it. I might work on something else, and return to it later.
Box collision.
http://www.google.dk/search?hl=da&q=...%B8gning&meta=
Lol ok thanks. And tactical how would I implement scrolling?Zitat:
Zitat von Anti-QJ
What did you have in mind. If nothing then you might be able to help me out. Any good with GFX ?Zitat:
Zitat von gameo
Well with scrolling the way i figured out is probably not the most efficient way but it gets the job done. Here's my filebrowser snippet that uses scrolling:
Just edit it to fit the file printing script you use.Code:s = 1
k = 0
System.currentDirectory("ms0:/")
fl=System.listDirectory()
nf=table.getn(fl)
oldpad = Controls.read()
while true do
if s > nf then s = 1 end
if s < 1 then s = nf end
--scrolling portion starts here
if s < 27 then k = 0 end
for i = 1,10 do
if s > i*27-1 and s < i*27 + 27 then k = -270*i end
end
--ends here
for i=1,nf do
screen:print(10,k+i*10,fl[i].name,Color.new(255,255,255))--Notice the y formula used for printing the file list.
end
screen:print(10,k+10*s,fl[s].name,Color.new(255,255,0))
if pad:select() then loopvar = false end
if pad:down() and oldpad:down() ~= pad:down() then s = s + 1 end
if pad:up() and oldpad:up() ~= pad:up() then s = s - 1 end
if pad:cross() and fl[s].directory == false then
if string.sub(fl[s].name, -4) == ".lua" or string.sub(fl[s].name, -4) == ".LUA" then
screen:clear()
dofile(fl[s].name)
end
end
if pad:cross() and oldpad:cross() ~= pad:cross() and fl[s].directory == true then
System.currentDirectory(fl[s].name)
s = 1
fl=System.listDirectory()
nf=table.getn(fl)
end
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
Also, since it uses the for i = 1,10, 10 being highest thing, if the file is more than 300 lines long, it wont work. When I feel like it ill rewrite it to fit any file size.
ok, here is what i need, i need about 32 squares to randomly move around. how do i set that up? I really never did anything like this. and i need to do this super effecient. so what would be the best way to do this? they cant all start at once. i need to gradually introduce them. so maybe 5 one minute 10 the next and so on. like if number_of_squares==18 then make 18 squares. is there a sample i can look at or something?
Squares that randomly move around?
Well
square = { x = 200, y = 100, img = Image.createEmpty(32,32) }
square.img:clear(white)
choosedirection = math.random(2)
if choosedirection == 1 then
square.x = square.x + math.random(3)
square.y = square.y + math.random(3)
elseif choosedirection == 2 then
square.x = square.x - math.random(3)
square.y = square.y - math.random(3)
end
screen:blit(square.x, square.y, square.img)
Something like that?
I know how to do that, now how do i get over 30 of those going efficiently?
if i do this:
square1{la la la}
square2{la la la}
it would be slow, i need maximum speed.
Try a for loop.
loops slow things down to much. I know i could do a loop, but i am afraid it might slow it down too much.
How the heck will it slow it down? Besides unrolling a loop manually (which isn't viable in this case since you want to adjust the number of squares over a period of time), loops are the only other option.Zitat:
Zitat von dracule
Do it. If it is too slow then optimise it. Don't prematurely optimise. If you don't do this, you never get anything done.