Seite 144 von 342 ErsteErste ... 44 94 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 194 244 ... LetzteLetzte
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 ;)...

  
  1. #4291
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    glad to help u mate ;)



  2. #4292
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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

  3. #4293
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    Zitat Zitat von the undead
    ok im working on this game(cant discus it at the moment) but ive been trying hard and cant find a solution for my problem. I have a pic right, im tyring to get that pic go accross the screen(left to right, and right to left) at different y points(think like a grid...up and down)...but i need them to have collison(i have the function down, i just need to fill in some parts, when i get this part finished) If any one helps me they will be given the credit they diserve.
    Any one?

  4. #4294
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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

  5. #4295
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    Zitat Zitat von slicer4ever
    i did i was like right below it
    oh, ok thanks ill look at it
    -= 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

  6. #4296
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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 enough
    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

  7. #4297
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    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)

  8. #4298
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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)
    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

  9. #4299
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    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

  10. #4300
    Ponies and Unicorns
    Points: 5.778, Level: 49
    Level completed: 14%, Points required for next Level: 172
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Pelennor Fields
    Beiträge
    547
    Points
    5.778
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    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????
    end
    If 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. #4301
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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:

    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
    also i just thought of this try:

    Code:
    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
    but that would only be used if the creature isn't moving
    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

  12. #4302
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    ok now it works....but when it moves it just paste one image after the next like here is a pic

  13. #4303
    QJ Gamer Gold
    Points: 29.980, Level: 99
    Level completed: 99%, Points required for next Level: 20
    Overall activity: 99,0%

    Registriert seit
    Feb 2006
    Ort
    United Kingdom, London
    Beiträge
    3.493
    Points
    29.980
    Level
    99
    Downloads
    0
    Uploads
    0

    Standard

    How do I create a background color?

  14. #4304
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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

  15. #4305
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    Zitat Zitat von slicer4ever
    did you use a screen:clear() right after you call while true do?
    me?...ill try it

  16. #4306
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    @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 dead
    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

  17. #4307
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    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)

  18. #4308
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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

  19. #4309
    QJ Gamer Blue
    Points: 4.918, Level: 44
    Level completed: 84%, Points required for next Level: 32
    Overall activity: 0%

    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

    Standard

    if i have any more problems ill come back =)

  20. #4310
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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

  21. #4311
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von GuitarGod1134
    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????
    end
    ok. that will screw it up. there is a basic formula for 2d collisions:

    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
    just fill in the blanks.
    -= Double Post =-
    Zitat Zitat von slicer4ever
    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:

    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
    also i just thought of this try:

    Code:
    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
    but that would only be used if the creature isn't moving

    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
    --------------------------------------------------------------------------------------

  22. #4312
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    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

  23. #4313
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yoyomacy
    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


    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.
    --------------------------------------------------------------------------------------

  24. #4314
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    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...

  25. #4315
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    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
    end
    Geändert von Anti-QJ (12-11-2006 um 04:06 PM Uhr)

  26. #4316
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    @ 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:

    Code:
    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
    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 and
    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

  27. #4317
    Designs
    Points: 14.040, Level: 76
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Canada
    Beiträge
    1.395
    Points
    14.040
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    omg, can someone please tell me why my bullet is not moving?

  28. #4318
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    @pspgamer because you have to say screenixel(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 although
    Geä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

  29. #4319
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Thanks for your help!

  30. #4320
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    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 variable
    Geä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


 

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:01 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .