does anyone know why the game would only shoot one bullet when my shooting system is the same as evil mana's system
Printable View
does anyone know why the game would only shoot one bullet when my shooting system is the same as evil mana's system
there maybe a code stoping it in the halo game he could only shoot 5 bulletts at a time and they didnt come out right add something likke if bullet<1 in to one of the bullet functions perferably the one that controlls the bullet:cool:
No code = no idea.
Show the code for firing.
hes yousing evil manas bullet code ill look in to it
i think it yousing all of the bullets to fast:cool:
here is all my shooting code takin from my script
KEEP IN MIND THIS IS ONLY THE SHOOTING STUFF
function bulletSetup()
--Increase the current bullet by one, or reset it to 1
if currentBullet < 5 then
currentBullet = currentBullet + 1
else
currentBullet = 1
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
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
--Create Array for Bullets
BulletInfo = {}
for a = 1,5 do
BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = player.x + 32,
y = player.y + 25 }
end
if direction == "left" then
bullet = bullet1
end
if direction == "right" then
bullet = bullet
end
currentBullet = 0
bulletFire()
if pad:square() and oldpad:square() ~= pad:square() then
bulletSetup()
end
if direction == "right" then
bullet = bullet
end
andQuote:
if direction == "left" then
bullet = bullet1
end
if direction == "right" then
bullet = bullet
end
Are very wrong. Why do you want something to equal itself?Quote:
if direction == "right" then
bullet = bullet
end
should be 1.Quote:
currentBullet = 0
Why is the firing code in the middle of no where in the program?Quote:
BulletInfo[currentBullet].direction = direction
BulletInfo[currentBullet].firing = true
end
it still only shoots once
I say it be a 'flow of logic' problem. You might not be calling functions in the right order or in the right place. I ideally need the whole code to fix that.
do u want it to shoot 5 i dont remeber samus shooting more than 1 well except for littel ones you should put a thing in to stop quick shotting such as old pad and then allow any number of bullets are you going to make the charging bullet i could help wit that :cool: gettin so board of working on mine hope fully it will be ready before school becuz right now i got football 5 to 9 during school i wont have any time to do any thing till about 8:30 not including home work what was i talkin about agian:confused:
UPDATE
morph ball now works (w/ some help by crait)
and i have a game over screen now
http://i59.photobucket.com/albums/g2...a-xversion.png
I you need a shooting system, I have sumtin perfect for ya!! PM, its secret ;)
ok i compleatly re did my shooting code
erased every shooting bit and orginized it corectly
But now i have an error message saying
here is my code but i dont see any problem with line 33 cause the shooting code is abuot the same as evil mana'sQuote:
Originally Posted by lua error
so here is my code
---------player loading--------
player1 = Image.load("sprites/right1.png")
player2 = Image.load("sprites/right2.png")
player3 = Image.load("sprites/left1.png")
player4 = Image.load("sprites/left2.png")
morphball = Image.load("morphball.png")
-------backgound and other loading---
background = Image.load("background.png")
bullet = Image.load("bullet.png")
bullet1 = Image.load("bullet1.png")
----player properties----
player = {}
player.img= player1
player.gravity = 190
player.y = 100
player.x = 200
player.jumpspeed = 10
player.jumpstate = "ground"
--Create Array for Bullets
BulletInfo = {}
for a = 1,5 do
BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = player.x + 32,
y = player.y + 16 }
end
function bulletSetup()
--Increase the current bullet by one, or reset it to 1
if currentBullet < 5 then
currentBullet = currentBullet + 1
else
currentBullet = 1
end
if direction == "left" then
BulletInfo[currentBullet].x = player.x
BulletInfo[currentBullet].y = player.y + 16
end
if direction == "right" then
BulletInfo[currentBullet].x = player.x + 32
BulletInfo[currentBullet].y = player.y + 16
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 move()
rand=math.random(1,2)
if pad:left() and rand==1 then
player.x= player.x -4
player.img= player3
end
if pad:left() and rand==2 then
player.x= player.x -4
player.img= player4
end
if pad:right() and rand==1 then
player.x=player.x +4
player.img= player1
end
if pad:right() and rand==2 then
player.x= player.x +4
player.img= player2
end
end
while true do
pad = Controls.read()
screen:clear()
move()
screen:blit(0,0,background,false)
pad = Controls.read()
if pad:cross() and player.jumpstate == "ground" then player.jumpstate = "jumping"
end
if pad:circle() and oldpad:circle() ~= pad:circle() then
bulletSetup()
end
if pad:down() and player.jumpstate == "ground" then
player.img = morphball
end
if pad:right() and player.img == morphball then
player.x=player.x-4
end
if pad:left() and player.img == morphball then
player.x=player.x+4
end
if player.x >= 445 then
screen:clear()
dofile "credits.lua"
end
if player.jumpstate == "jumping" then
player.jumpspeed = player.jumpspeed - 0.5
player.gravity = player.gravity - player.jumpspeed
end
if player.gravity < 0 then
player.jumpstate = "falling"
end
if player.gravity < 190 and player.jumpstate == "falling" then
player.gravity = player.gravity + (player.jumpspeed + 3)
end
if player.gravity == 190 then
player.jumpspeed = 10
player.jumpstate = "ground"
end
if player.gravity > 190 then player.gravity = 230 end
player.y = player.gravity
screen:blit(player.x,player.y,player.img)
bulletFire()
screen.flip()
screen.waitVblankStart()
end
hope u guys can help
you haven't defined current bullet to a number yet. You need to define the variable currentbullet to first before it can be checked to see if it is less then 5. so put currentbullet = 1 line 33.
BTW, why not use my system for bullets, I sent you?
cause i have to add an enemy and i am not doing that right now
ok, so anyways put currentbullet = 1 before line 33. That way you not comparing a nil variable to with a number ;)
k i fixed that problem but know i have a bullet that just stays in one spot and doesent move
http://i59.photobucket.com/albums/g2...screenshot.png
oh and i forgot to show u guys the bg's that pspdemon made
http://i59.photobucket.com/albums/g297/ninja9393/1.png
http://i59.photobucket.com/albums/g297/ninja9393/2.png
http://i59.photobucket.com/albums/g297/ninja9393/3.png
I think its because you not defining wether the variable diretion is left or right.... Also when you have
if pad:circle() then
bulletsetup()
end
I think you need to replace that wil bulletfire() and then put bulletsetup() where bulletfir is now...
IT WORKS KINDA NOT GOOD but it shoots more then one bullet
scrren:http://i59.photobucket.com/albums/g2...reenshot-1.png
yeah, evilmanas bullet system is meant to shoot 5 and only 5 bullets
Mine on the other hand is not. It shoots one bullet when ever you press circle
im glad is going well. hope for the best :)
Quick hack fix
Note that I changed the images because I dont have any of them. The code I added could use cleaning depending on your coding style. Your main problem is that are lots of variables that were out of scope of the areas that needed them. Eg. Direction, currentBullet, oldpad.
Quote:
---------player loading--------
player1 = Image.load("player.png")
player2 = Image.load("player.png")
player3 = Image.load("player.png")
player4 = Image.load("player.png")
morphball = Image.load("player.png")
-------backgound and other loading---
background = Image.load("player.png")
bullet = Image.load("bullet.png")
bullet1 = Image.load("bullet.png")
----player properties----
player = {}
player.img= player1
player.gravity = 190
player.y = 100
player.x = 200
player.jumpspeed = 10
player.jumpstate = "ground"
--Create Array for Bullets
BulletInfo = {}
for a = 1,5 do
BulletInfo[a] = { pic = bullet , firing = false, direction = "right", x = player.x + 32,
y = player.y + 16 }
end
currentBullet = 1
function bulletSetup(direction)
--Increase the current bullet by one, or reset it to 1
if currentBullet < 5 then
currentBullet = currentBullet + 1
else
currentBullet = 1
end
if direction == "left" then
BulletInfo[currentBullet].x = player.x
BulletInfo[currentBullet].y = player.y + 16
end
if direction == "right" then
BulletInfo[currentBullet].x = player.x + 32
BulletInfo[currentBullet].y = player.y + 16
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
playerdirection = "right"
function move()
rand=math.random(1,2)
if pad:left() and rand==1 then
player.x= player.x -4
player.img= player3
playerdirection = "left"
end
if pad:left() and rand==2 then
player.x= player.x -4
player.img= player4
playerdirection = "left"
end
if pad:right() and rand==1 then
player.x=player.x +4
player.img= player1
playerdirection = "right"
end
if pad:right() and rand==2 then
player.x= player.x +4
player.img= player2
playerdirection = "right"
end
end
pad = Controls.read()
oldpad = pad
while true do
oldpad = pad
pad = Controls.read()
screen:clear()
move()
screen:blit(0,0,background,false)
if pad:cross() and player.jumpstate == "ground" then player.jumpstate = "jumping"
end
if pad:circle() and oldpad:circle() ~= pad:circle() then
bulletSetup(playerdirection)
end
if pad:down() and player.jumpstate == "ground" then
player.img = morphball
end
if pad:right() and player.img == morphball then
player.x=player.x-4
end
if pad:left() and player.img == morphball then
player.x=player.x+4
end
if player.x >= 445 then
screen:clear()
dofile "credits.lua"
end
if player.jumpstate == "jumping" then
player.jumpspeed = player.jumpspeed - 0.5
player.gravity = player.gravity - player.jumpspeed
end
if player.gravity < 0 then
player.jumpstate = "falling"
end
if player.gravity < 190 and player.jumpstate == "falling" then
player.gravity = player.gravity + (player.jumpspeed + 3)
end
if player.gravity == 190 then
player.jumpspeed = 10
player.jumpstate = "ground"
end
if player.gravity > 190 then player.gravity = 230 end
player.y = player.gravity
screen:blit(player.x,player.y,player.img)
bulletFire()
screen.flip()
screen.waitVblankStart()
end
now it only shoots once each time
thanks yaustar
It shoots 5 for mine.
no i am sying it dosent shoot like one hundered each time u press circleQuote:
Originally Posted by yaustar
it shoots once for each time u press circle
So its a good thing right?
version 1.5 released
if i made missles would i need a whole new bullet system for the missles or can i use the same one and load it w/ a diffrent pic???
You can use the latter method:
"i use the same one and load it w/ a diffrent pic???"
You might want to have the bullets have a 'type' so that you can check if a bullet is a missile or a standard beam for damage calculation.
ok school is starting for me again
but i will still try to work on this game a hour and a half a day
and on weekends maybe even more
i have been very wrong about my realease dates so dont thak this as an positive one but 2.0 should be ready in 8/21/06
features will include
missles
morhball bomb's
morphball animation
healthbar
gameover screen
ability to go into 2 other rooms
just one thing m8, the animation of samus is not correct, her legs move to fast.
great mod
Yep, it's been noted many times. Basically the animation technique is flawed by using random numbers to decide the frame of animation every frame.Quote:
Originally Posted by NSCXP2005
you can youse my animation system for my beta of 2df
i am using jman420's animation system and when i released 1.5 there was a glitch in the animaton so i released it without it
it was noted in the release of 1.5
http://www.dcemu.co.uk/vbulletin/showthread.php?t=31767
cool
ok i decided to make a bet version of metroid(beta 2) exsclusivly for beta tester's
beta 2 features
missles
game over healthbar
version 2.0 features
all the stuff from beta 2
morph ball animation
ability to go through the door to 2 other rooms
beta testers pm me cause there will be a new password
bum bum buda bum bum bum bum bum buuh bum bada bada bah bah abh
ANIMATION IS NOW FIXED USING JMAN420's ANAMATION SYSTEM SO EVERYONE CAN STOP NAGGING:D
ohh and the healthbar is done
Attachment 9034
nice
Do you think I could beta test?
sureQuote:
Originally Posted by Video_freak
i will pm u the new password