Zeige Ergebnis 4.291 bis 4.320 von 10238
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; glad to help u mate ;)...
-
11-25-2006, 02:55 PM #4291QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
glad to help u mate ;)
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
11-25-2006, 03:49 PM #4292QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
or use cmd and it won't do that
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
-
11-25-2006, 03:57 PM #4293QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
Any one?
Zitat von the undead
-
11-25-2006, 04:03 PM #4294QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
i did i was like right below it
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
-
11-25-2006, 04:04 PM #4295QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
oh, ok thanks ill look at it
Zitat von slicer4ever
-= Double Post =-
wait...i dont understand it.....can u explain it to me please?Geändert von the undead (11-25-2006 um 04:04 PM Uhr) Grund: Automerged Doublepost
-
11-25-2006, 04:08 PM #4296QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
you were asking how to move it across the screen so thus when you blit the image it would be something like:
screen:blit(playerx,playe ry,player)
so to move it left you decrease the playerx and vice versa for right
now then to make it move to the left when the playery reaches a certain point you place an if statement to check when the playery hit's a certain area like:
if playery == 20 then
playerx = playerx - 1
end
i hope i explained it enough1. 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
-
11-25-2006, 04:11 PM #4297QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
oh ok.....i understand it now, but what i wanted was it to blit an enimey at random and move it across the screen(left to right, right to left)
-
11-25-2006, 04:18 PM #4298QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o well we will work with one enemy than
Code:enemy = Image.load("image") --if i remeber correctly the random call starts at 0 to number that you define direction = 0 -- 0 = left 1 = right enemyx = 0 enemyy = 0 enemy_move = 0 -- 0 = yes 1 = no while true do if enemy_move == 0 then enemyx = random(480) enemyy = random(272) enemy_move = 1 direction = random(1) end if enemy_move == 1 then if direction == 0 then enemyx = enemyx - 1 end if direction == 1 then enemyx = enemyx + 1 end end if enemyx < 0 or enemyx > 480 then enemy_move = 0 end screen:blit(enemyx,enemyy,enemy) 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
-
11-25-2006, 04:39 PM #4299QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
k ill try that
-= Double Post =-
i did it but i get an error "attempt to call global 'random'<a nil value>Geändert von the undead (11-25-2006 um 04:39 PM Uhr) Grund: Automerged Doublepost
-
11-25-2006, 04:40 PM #4300Ponies and Unicorns
- Registriert seit
- Aug 2006
- Ort
- Pelennor Fields
- Beiträge
- 547
- Points
- 5.778
- Level
- 49
- Downloads
- 0
- Uploads
- 0
how do i make it so that an image dissapears when another one touches it for example a bullet hitting a creature.
you would do collsion detection like
if bullet[1].x == creature[1].x and bullet[1].y == creature[1].y then
what would i put right here????
endIf you play WoW come find me on DOOMHAMMER (US) I am Human mage lvl 64 Atrana is the name (dont ask for runs!)
Gold donations are highly appreciated!
-
11-25-2006, 04:40 PM #4301QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o i think it's math.random(number) sorry it's been a little bit since i coded in lua
@ gurtar god you just reset it off the screen so it can be used again later if you want code i need to see some of your code so i can help you more also you don't want to use == as that's to precise
but if i can make any sense try:
also i just thought of this try:Code:if bullet[1].x == creature[1].x and bullet[1].y == creature[1].y then bullet[1].x = -50 bullet[1].y = -50 --other bullet variables are reset to end
but that would only be used if the creature isn't movingCode:if bullet[1].x ~= creature[1].x and bullet[1].y ~= creature[1].y then screen:blit(bullet[1].x,bullet[1].y,bullet) end
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
-
11-25-2006, 04:48 PM #4302QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
ok now it works....but when it moves it just paste one image after the next like here is a pic
-
11-25-2006, 04:49 PM #4303QJ Gamer Gold
- Registriert seit
- Feb 2006
- Ort
- United Kingdom, London
- Beiträge
- 3.493
- Points
- 29.980
- Level
- 99
- Downloads
- 0
- Uploads
- 0
How do I create a background color?
-
11-25-2006, 04:50 PM #4304QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
did you use a screen:clear() right after you call while true do?
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
-
11-25-2006, 04:50 PM #4305QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
me?...ill try it
Zitat von slicer4ever
-
11-25-2006, 04:54 PM #4306QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@ninj 3 ways:
1:
color = Color.new(0,0,0)
while true do
screen:clear()
screen:fillRect(0,0,480,2 72,color)
code
screen.flip()
screen.waitVblankStart()
end
2:
--sorry if i incorrectly call the following command
color = Color.new(0,0,0)
bg = Image.new(272,480)
bg:clear(color)
while true do
screen:clear()
screen:blit(0,0,bg)
code
screen:flip()
screen:waitVblankStrart()
end
or 3:
color = Color.new(0,0,0)
while true do
screen:clear(color)
code
screen.flip()
screen.waitVblankStart()
end
the 3rd way works the best but they all would work
edit: and yes you dead1. 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
-
11-25-2006, 04:55 PM #4307QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
ok, cool now it works....now i think i can do the rest myself(ima add other enemys...oh and thx, ill give u credit)
-
11-25-2006, 04:56 PM #4308QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
np just here 2 help
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
-
11-25-2006, 04:57 PM #4309QJ Gamer Blue
- Registriert seit
- Sep 2006
- Ort
- 6ft. Down Underground........Oh and guess what my avatar is
- Beiträge
- 387
- Points
- 4.918
- Level
- 44
- Downloads
- 0
- Uploads
- 0
if i have any more problems ill come back =)
-
11-25-2006, 04:58 PM #4310QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
you can just pm me with any probs i'm ganna be on a lot more unless i'm codeing even then i'm usually on
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
-
11-25-2006, 06:44 PM #4311Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
ok. that will screw it up. there is a basic formula for 2d collisions:
Zitat von GuitarGod1134
just fill in the blanks.Code:if ((object.x + object.width) >= enemy.x) and (object.x <= (enemy.x + enemy.width)) and ((object.y + object.height) >= enemy.y) and (object.y <= (enemy.y + enemy.height)) then --collision is true -- end
-= Double Post =-
Zitat von slicer4ever
what???? do you know what the ~= operator means?
it means "NOT equal". i think you thought that it meant "approximately equal"Geändert von Grimfate126 (11-25-2006 um 06:44 PM Uhr) Grund: Automerged Doublepost
--------------------------------------------------------------------------------------
-
11-25-2006, 07:59 PM #4312Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
here is my code so far for my new game, problem is, when i press x to shoot, the bullet just appears and disappears in the bottom left corner with out moving in any direction any reason why?
Code:green=Color.new(0,255,0) white = Color.new(255,255,255) red = Color.new(255,0,0) dofile("animLib.lua") System.usbDiskModeActivate() runR = ANIM.new(7, "RunR-", "png", "Player/Run/") runL = ANIM.new(7, "RunL-", "png", "Player/Run/") standR = ANIM.new(3, "StandR-", "png", "Player/Stand/") standL = ANIM.new(3, "StandL-", "png", "Player/Stand/") shootR = ANIM.new(2, "ShootR-", "png", "Player/Shooting/") shootL = ANIM.new(2, "ShootL-", "png", "Player/Shooting/") playerState = "standingR" shootDirection = "right" playerX = 10 playerY = 200 --Create a blank image and fill it with green. This will be our bullet. bullet = Image.load("Player/Shooting/bullet.png") while true do oldpad = Controls.read() pad = Controls.read() screen:clear() if pad:right() then playerState = "runningR" playerX = playerX + 3 shootDirection = "right" end if pad:left() then playerState = "runningL" playerX = playerX - 3 shootDirection = "left" end if pad:select() then break end if shootDirection == "right" and not pad:right() and not pad:left() then playerState = "standingR" elseif shootDirection == "left" and not pad:right() and not pad:left() then playerState = "standingL" end if playerState == "standingR" and pad:cross() then playerState = "shootingR" playerX = playerX shootDirection = "right" end if playerState == "standingL" and pad:cross() then playerState = "shootingL" playerX = playerX shootDirection = "left" end if playerState == "runningR" and pad:cross() then playerState = "shootingR" playerX = playerX shootDirection = "right" end if playerState == "runningL" and pad:cross() then playerState = "shootingL" playerX = playerX shootDirection = "left" end if playerState == "standingR" then standR:blit(playerX, playerY, 100) elseif playerState == "standingL" then standL:blit(playerX, playerY, 100) elseif playerState == "runningR" then runR:blit(playerX, playerY, 50) elseif playerState == "runningL" then runL:blit(playerX, playerY, 50) elseif playerState == "shootingR" then shootR:blit(playerX, playerY, 50) elseif playerState == "shootingL" then shootL:blit(playerX, playerY, 50) end currentBullet = 0 direction = "right" Player = {} Player[1] = { x = 10, y = 200 } BulletInfo = {} for a = 1,5 do BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = Player[1].x + 32, y = Player[1].y + 16 } end function bulletSetup() if currentBullet < 5 then currentBullet = currentBullet + 1 else currentBullet = 1 end if direction == "left" then BulletInfo[currentBullet].x = Player[1].x BulletInfo[currentBullet].y = Player[1].y + 16 end if direction == "right" then BulletInfo[currentBullet].x = Player[1].x + 32 BulletInfo[currentBullet].y = Player[1].y + 16 end if direction == "up" then BulletInfo[currentBullet].x = Player[1].x + 16 BulletInfo[currentBullet].y = Player[1].y end if direction == "down" then BulletInfo[currentBullet].x = Player[1].x + 16 BulletInfo[currentBullet].y = Player[1].y + 32 end BulletInfo[currentBullet].direction = direction BulletInfo[currentBullet].firing = true end function bulletFire() for i = 1,5 do if BulletInfo[i].firing == true then if BulletInfo[i].direction == "right" then BulletInfo[i].x = BulletInfo[i].x + 10 end if BulletInfo[i].direction == "left" then BulletInfo[i].x = BulletInfo[i].x - 10 end if BulletInfo[i].direction == "up" then BulletInfo[i].y = BulletInfo[i].y - 10 end if BulletInfo[i].direction == "down" then BulletInfo[i].y = BulletInfo[i].y + 10 end screen:blit(BulletInfo[i].x,BulletInfo[i].y,BulletInfo[i].pic) end if BulletInfo[i].x < 0 or BulletInfo[i].x > 480 or BulletInfo[i].y < 0 or BulletInfo[i].y > 272 then BulletInfo[i].firing = false end end end function movePlayer() pad = Controls.read() if pad:left() then Player[1].x = Player[1].x - 1 direction = "left" end if pad:right() then Player[1].x = Player[1].x + 1 direction = "right" end if pad:up() then Player[1].y = Player[1].y - 1 direction = "up" end if pad:down() then Player[1].y = Player[1].y + 1 direction = "down" end end if pad:cross() and oldpad:cross() ~= pad:cross() then bulletSetup() end movePlayer() bulletFire() screen.waitVblankStart() screen.flip() oldpad = pad end
-
11-25-2006, 08:16 PM #4313Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Zitat von yoyomacy
i dont have time to look over the entire thing, but you are just copying and pasting. you have multiple "players" and no organization. write the code yourself. copying wont make you learn.--------------------------------------------------------------------------------------
-
11-25-2006, 08:22 PM #4314Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
i have 2 players on purpose, one is the one that shoots the bullet, and over it would be the player with animation, since i dontk now how to fuse them, i did that, not copied and pasted ignorantly...

-
11-25-2006, 08:24 PM #4315lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
It has 2 white pixels on the left side of the screen, But they arent moving, They just stay still, I tried to run this in both the PSP and the PC and still, Theirs 2 white pixels on the left side, Anyone know why?
Code:starfield = {} math.randomseed(os.time()) function createStar(i) starfield[i] = {} starfield[i].x = math.random(2*width) - width starfield[i].y = math.random(2*height) - height starfield[i].z = zMax end for i = 1, size do createStar(i) starfield[i].z = math.random(zMax) end white = Color.new(255, 255, 255) black = Color.new(0, 0, 0) while true do screen:clear(black) screen:blit(0, 0, background) for i = 1, size do starfield[i].z = starfield[i].z - speed if starfield[i].z < speed then createStar(i) end x = width / 2 + starfield[i].x / starfield[i].z y = height / 2 + starfield[i].y / starfield[i].z if x < 0 or y < 0 or x >= width or y >= height then createStar(i) else screen:pixel(x, y, white) end end screen.waitVblankStart() screen.flip() if Controls.read():start() then break end endGeändert von Anti-QJ (12-11-2006 um 04:06 PM Uhr)
-
11-25-2006, 08:31 PM #4316QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@ grimfate yes i do know what that means it means not now then if you read what he was asking you would know why i did that instead of going off at me about it he was asking how to make the bullet disappear when it hit so i said the following:
which if you had read it like said is saying if the bullet isn't hitting the target x/y then show the bullet and as i look at it i should have put or instead of andCode:if bullet[1].x ~= creature[1].x and bullet[1].y ~= creature[1].y then screen:blit(bullet[1].x,bullet[1].y,bullet) end
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
-
11-25-2006, 08:47 PM #4317Designs

- Registriert seit
- Jul 2006
- Ort
- Canada
- Beiträge
- 1.395
- Points
- 14.040
- Level
- 76
- Downloads
- 0
- Uploads
- 0
omg, can someone please tell me why my bullet is not moving?

-
11-25-2006, 09:01 PM #4318QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@pspgamer because you have to say screen
ixel(x,y,white) inside the for loop and at the starfield x and y otherwise it's only returning the last starfield x/y of the loop
-= Double Post =-
@yoyo i surgest you re-write it as it is extreamly messy which i am trying to look though it and it is most likly you have a conflicting variable somewhere which is reseting the bullet
-= Double Post =-
also because you appear to be calling functions inside the while true do it is very messy althoughGeändert von slicer4ever (11-25-2006 um 09:01 PM Uhr) Grund: Automerged Doublepost
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
-
11-25-2006, 09:02 PM #4319lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Thanks for your help!
-
11-25-2006, 09:07 PM #4320QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
np anytime=-)
-= Double Post =-
@ yoyo i see why it's because your constantly setting the currentbullet to 0 look after your first few elseif's and it well say currentBullet = 0 delete that
-= Double Post =-
which means i was right and it was a conflicting variableGeändert von slicer4ever (11-25-2006 um 09:07 PM Uhr) Grund: Automerged Doublepost
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


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