I need some help with bullets....
When I shoot, the bullets go fine, but when i hit another key the bullets go the other way
When I shoot, the bullets go fine, but when i hit another key the bullets go the other way
AppTitle "Jim's Adventure" Graphics 800,600,0,2 jimimage = LoadImage("jim.bmp") cvimage = LoadAnimImage("cv.bmp",45,15,0,2) bulletfont = LoadFont("Impact",20,False,False,False) bulletimage = LoadImage("bullet.bmp") ;mask all the images MaskImage jimimage,255,0,255 MaskImage cvimage,255,255,255 ; make the type Type jim Field x,y Field grav End Type Type cv Field x,y Field frame Field ammo_c ;ammo in clip Field ammo_t ;ammo total Field reload Field speed Field timer Field guntimer Field bullet End Type Type grenade Field x,y End Type Type bullet Field x,y Field direction End Type ;create the types j.jim = New jim cv.cv = New cv gr.grenade = New grenade ;variables for guns anc char. j\x = 400 j\y = 400 cv\ammo_c = 30 cv\ammo_t = 27 cv\timer = MilliSecs() cv\speed = 10 cv\timer = 0 cv\reload = 0 cv_on = True gr_on = False direction = False ammo_transfer = 0 SetBuffer BackBuffer() ;==========================MAIN CODING================== While Not KeyDown(1) ;draw the jimimage 1st so the guns will go in front of him DrawImage jimimage,j\x,j\y ;gun if's ;=================================CV============================ If cv_on = True cv\x = j\x - 9 cv\y = j\y + 30 DrawImage cvimage,cv\x,cv\y,direction Color 255,141,47 SetFont bulletfont Text 700,550,""+ cv\ammo_c,False,False Text 730,550,"",False,False Text 755,550,""+cv\ammo_t,False,False EndIf ;================================================================ ;========================CHARACTER STATS========================= If KeyDown(203) j\x = j\x - 3 direction = 1 ElseIf KeyDown(205) j\x = j\x + 3 direction = 0 EndIf ;------------------------------shot?---------------------------- ;=================BULLET CLIP TESTS================= If cv\ammo_c <= 0 ammo_transfer = cv\ammo_t If ammo_transfer >= 30 ammo_transfer = 30 Else ammo_transfer = cv\ammo_t cv\ammo_t = cv\ammo_t - ammo_transfer cv\ammo_c = cv\ammo_c + ammo_transfer EndIf EndIf ;=================================================== ;================CREATE BULLETS===================== ;--------------------CV----------------------------- If KeyDown(57) And cv_on = True And cv\ammo_c > 0 If MilliSecs() - cv\timer > 100 b.bullet = New bullet b\x = cv\x + Rnd(20,23) b\y = cv\y + Rnd(2,3) cv\ammo_c = cv\ammo_c - 1 DrawImage(bulletimage,cv\x,cv\y) cv\timer = MilliSecs() EndIf EndIf For b.bullet = Each bullet If direction = 0 b\x = b\x + 10 DrawImage(bulletimage,b\x,b\y) EndIf Next ;draw cv bullets For b.bullet = Each bullet If direction = 1 b\x = b\x - 10 DrawImage(bulletimage,b\x,b\y) EndIf Next ;END CV ;------------------------------------------------------ Flip Cls Wend