A little help if possible
I'm currently working on my next release of the crappy Gored game I made a while back :p . I'm kinda stuck now and I was hoping someone could maybe give me a hand for a sec. I wanna add a bullet function to the game so when I shoot it comes out of the barrel and leaves for the current cursor possition. I have made a simple function, but its far from beying what I need.
This makes the bullet leave from the barrel to the end of the screen. Problem is, if I move the cursor, the bullet follows. :doh: That's because of the "x0" part wich is a reference for lots of things inside the script. (cursor position, gun position, etc..)
bulletX = x0 + 12
bullet = 1
bulletY = bulletY - 8
screen:blit(bulletX, bulletY, bulletimg)
if bulletY <= 0 then bullet = 0 bulletY = 250 end
I'de need to somehow make "bulletX" = to current x0 position... and nothing more. I've tried useless stuff like this:
But like I said, useless, just makes the bullet jerk left and right when I press the analog stick. Anybody have a clue how I would specify this?
bulletX = (x0 - dx) + 12
bulletX = (math.abs(dx)x0) + 12