need help again i got bullet shooting but how do i make it so when it shoots the other player he dies
Printable View
need help again i got bullet shooting but how do i make it so when it shoots the other player he dies
xbullet is the x coordinate of the bulletCode:if xbullet+bullet:width()>=xtarget and ybullet+bullet:height()>=ytarget and ybullet<=ytarget then
health=0
end
ybullet is the y ""
xtarget is the x coordinate for the target
ytarget is the y " "
hi all is it possible to do this?? i dunt have my psp with me, but im makin a sidescroller game, and i want the enemies to be offscreen at first, and then come onscreen.
heres my code: use any picture for enemy:
and i would do this for every enemy i wantedCode:enemy = true
enemyx = 580
enemyy = 120
screen:blit(enemyx, enemyy, enemy)
enemyx = enemyx+2
if enemyx < 0 then
enemy = false
end
Everything would work there, except how you set "enemy" to true and then tried to blit it. I'm not sure if you were going to do this but you first have to load an image, then blit that variable. For example:Zitat:
Zitat von Grimfate126
Unless you were already going to do that, I couldn't exactly tell what you meant. Also, if you don't have your PSP, and even if you do, I would definitely recommend Windows LUAPlayer ( can be found on www.luaplayer.org). This way you can test your app at any stage of development on your computer, view exact errors(along with the line number they are on), and you don't have to eep putting it on your PSP.Code:enemy1 = Image.load("enemy1.png")
enemyx = 580
enemyy = 120
screen:blit(enemyx, enemyy, enemy)
enemyx = enemyx+2
if enemyx < 0 then
enemy = false
end
I wish there was a linux version. It doesnt matter actually cause im gonna go back to windows next week orso. But its a pain in the ass coding because i have to put it back and forth between the pc and psp.
im so off today but thx for that last code altair but now i need to know is this right
ive never done this type of code before what i want it to do is restart the script when the other player gets hit please help! :icon_sad:Code:if health=0 then
break
end
Hey, could anyone give me a PM on this -
I need to make a few bug fixes to my Lua game, but I don't know how the bugs can be fixed. So, I need a tiny bit of help, and my game will be released. Thanks :)
Oh, heres a screenshot of the game in action BTW: its a Rock Paper Scissors game. I don't think that's been done before.
http://i2.tinypic.com/son9l2.jpg
Well if you use that code it will break out of the loop. If there is no loop outside of the loop you break out of, then your game will exit.
Also you have to use two ='s at an if statement. So it becomes:
Code:if health==0 then
break
end
thanks again altair i will give u credit on helping with my game :D
no prob at all and thx!
has ANYONE even tried the sound:playing() function?
Can anyone give me an idea for a simple game to code? Im totally scrapping my current project... (for now anyway) Its really pissin me off...
im SO close to getting this done i need 2 things left and its DONE!!! i have an idea for u shakemaybe like a motocycle game side scrolling and u have to jump over barrels and whatever else gets in ur way. im to busy to make that one so if u want there ya go
Yeah I could but theres alrweady a "Fusion Frenzy" clone similar... I was making a clone of the game "Stick Avalanche" but I couldnt get anything to work...
could someone tell me if this code is right its for health
Code:if BulletInfo[i].x+bullet:width()>=Player[2].x + 1 and BulletInfo[i].y+bullet:height()>=Player[2].y + 1 and BulletInfo[i].y<=Player[2].y + 1 then
health=0
end
yeah that should work.
Zitat:
Zitat von youresam
Hmm, yeah i dont know. I dont thinks so. I see people use it quite often on the forum, but its not in the list of cammands, so.....
But there is an easy way of simulating that:
Code:sound:play()
playing=true
To Spiritbeast:
Plz clear your PM box so i can conatct u.
Hey Vaza, hows Garage PSP going? Are you still working on that?
Im gonna go for that after Chao Garden, its postponed til then. You working on anything? or just being the "really helpful guy, in the LUA Help Thread, but has no projects currently"?Zitat:
Zitat von Altair
Well i hinted at it a few times, but besides being the "really helpful guy, in the LUA Help Thread", im also working on a project of my own (a RTS).
Im pretty far at the moment. I just need to make some graphics for other units and buildings and a menu and then implement them and i will release a beta i think. But since i dont have the right stuff on my pc here ill have to wait till next weekend. If thats done i will release something soon.
Got a question: Does anyone know, if using "dofile()" uses more memory then if you put it in the same file?
I ask this because if you run one lua file and in it you call another one. If you quit that one, you "fall back to the old lua file. So does this mean it has that state saved in the memory? And would that be a big amount it would use or is it really really small?
Hope its clear
Kool, I thought that to myself before, my guess would be it would take up alot, another problem with do file is, if you move to the main game, and you unload your menu images for more space, but if you break it and will mess up the menu, due to the images being nil.Zitat:
Zitat von Altair
well could ofcourse make it load the images again before i go back to the menu. So it only loads them when i need them.
Okay. How could I have it so if I press X then 1 of 5 (or however many) sentences will pop up? would i do need to store the value from math.random() into a variable then print it onto the screen? Would this work?Code:while true do
screen.clear()
pad=Controls.read()
if pad:cross() then
do math.Random(5)
math.Random(5)
if math.random(5) = 1 then
screen:print(130,200,1,white)
if math.random(5) = 2 then
screen:print(130,200,2,white)
if math.random(5) = 3 then
screen:print(130,200,3,white)
if math.random(5) = 4 then
screen:print(130,200,4,white)
if math.random(5) = 5 then
screen:print(130,200,5,white)
screen.waitVblankStart()
screen.flip()
end
I really want and need a Wi-Fi turotial for lua!
I guess i am not the only one?
@MaSt3r_ShAk3:
You cant say "do math.random(5)". Also close ever "if then" statement with an "end" statement. Also you have to say "if ... == ... then" and not "if ... = ... then". So you have to use TWO "="'s.
So it becomes:
Code:while true do
screen.clear()
pad=Controls.read()
if pad:cross() then
random=math.Random(5)
if random == 1 then
screen:print(130,200,1,white)
end
if random == 2 then
screen:print(130,200,2,white)
end
if random == 3 then
screen:print(130,200,3,white)
end
if random == 4 then
screen:print(130,200,4,white)
end
if random == 5 then
screen:print(130,200,5,white)
end
screen.waitVblankStart()
screen.flip()
end
Ok, I get an error. Unexpected symbol near '1'
o yeah i just noticed: "screen:print(130,200,4,w hite)"
should be:
"screen:print(130,200,"4" ,white)"
And that for all these commands. You see, if you want it to display the character 4 then you have to put it in "'s (dont know what they're called :P ). If you dont then lua treats it like a variable.
i think i got all the errors. it actually starts now.
u gotta define the whatchacallits tho
Code:white = Color.new(0, 0, 0)
while true do
screen:clear()
pad=Controls.read()
if pad:cross() then
do math.Random(5)
end
math.Random(5)
if math.random(5) == 1 then
screen:print(130,200,"1",white)
end
if math.random(5) == 2 then
screen:print(130,200,"2",white)
end
if math.random(5) == 3 then
screen:print(130,200,"3",white)
end
if math.random(5) == 4 then
screen:print(130,200,"4",white)
end
if math.random(5) == 5 then
screen:print(130,200,"5",white)
end
screen.waitVblankStart()
screen.flip()
end
end
It IS a variable and "s are called quotations. But i will just have the random number print text. Thanks alot!
O yeah lol quotations that was it, thx.
Ok well if they are variables, then you have to define them first. So say like:
1="hello"
But i dont know if you can use numders as variables.
Yeah, i was thinking that but Ill do this for now. But what does this error mean??Code:error:script.lua:5: Argument Error: Image:clear([color]) zero or one argument
well i dont know whats at line 5 so i can only guess.
Or you have the wrong name for the image, or something is wrong with your spelling probably. But i cant tell without the code you have now. Check all the names!
Ok cool... I test on window lua player and when I press X nothing happens...
Hope this helps!
Code:r = 1
white = Color.new(255, 255, 255)
quotes = {}
quotes[0] = "Hello from number 0"
quotes[1] = "Hello from number 1"
quotes[2] = "Hello from number 2"
quotes[3] = "Hello from number 3"
quotes[4] = "Hello from number 4"
quotes[5] = "Hello from number 5"
while true do
screen:clear()
pad = Controls.read()
if pad:cross() and pad ~= oldpad then r = math.random(5) end
screen:print(130, 200, quotes[r], white)
oldpad = pad
screen.flip()
screen.waitVblankStart()
end
ok i really need to know how to make like a file browser, just to load files e.g bmp's and stuff. It says stuff about tables and i dont know how to use them, please help :$
Sorry i cant help ya there. I dont know, and im not planning on checking how the bmplib works so i cant help you.
Also, if i were you i would learn how to use tables they'll come in handy on many occasions. Its not that difficult either. And if you learn how it works maybe you can figure out how the bmplib works yourself?
Here's an example that builds a table and then prints the results to your screen. I'm sure you can figure out how to load the images and display them from here...
HTH!Code:white = Color.new(255, 255, 255)
tblImages = {}
count = 1
imageList = System.listDirectory("./images/")
for index, imageFile in imageList do
if not imageFile.directory then
tblImages[count] = imageFile.name
count = count + 1
end
end
while true do
y = 10
for _, v in pairs (tblImages) do
screen:print(0, y, v, white)
y = y + 10
end
screen.flip()
screen.waitVblankStart()
end
Hi everyone, The problem I am having is after I have writen my lua script, saved it as index.lua, I open the lua player, and it will say no script found (or something similar) What's the problem here?