none
Bullet Collision not working RRS feed

  • Question

  • hi there!
    i extremely optimized my game. but somehow the bullet collision with the zombie doesnt work. the zombie is supposed to lose hp and die when the hp reached 0.. but nothing happens
    (The "collision" code is in the "ZombieCode" Sub)

    heres the package:
    http://rapidshare.com/files/287882814/ZombieGame.rar.html

    i hope someone can help...
    Live for nothing, OR CODE FOR SOMETHING!
    Friday, October 2, 2009 7:57 PM

Answers

  • okay, i found out whats the bug. it was this part here:
    If Bullet_Y[n]>=Zombie_Top and Bullet_Y[n]<=Zombie_Bottom and Bullet_X[n]<=Zombie_Right[Z] and Bullet_X[n]>=Zombie_Left[Z] Then 
    Shapes.Remove(Bullet[n]) Bullet_Impact_X=Bullet_X[n]
    Bullet_Impact_Y=Bullet_Y[n]
    Zombie_HP[Z]=Zombie_HP[Z]-20
    BloodEmitter() Bullet_Y[n]=-1000
    Bullet_X[n]=-1000
    endif
    i removed this part here:
    and Bullet_Y[n]<=Zombie_Bottom
    and it worked great.
    i really dont get why this didnt work! and this can just be a temporary fix...

    the bullets spawn at Player_CX (center x) and Player_CY (center y) but somehow the CY coordinate is lower than the zombie bottom, even when the buttons spawn higher than the zombie bottom.. wtf???? (the zombie_bottom is about 100 to high. idk why...) i hope you guys know what i mean. or just replace your code with this one here: HTR467 and compare the coordinates in the textwindow...

    i hope someone can tell me whats the matter...
    Live for nothing, OR CODE FOR SOMETHING!
    • Marked as answer by Dudeson Sunday, October 11, 2009 10:45 PM
    Friday, October 2, 2009 10:00 PM
  • nvm. i solved it..
    Live for nothing, OR CODE FOR SOMETHING!
    • Marked as answer by Dudeson Sunday, October 11, 2009 10:47 PM
    Sunday, October 11, 2009 10:47 PM

All replies

  • okay, i found out whats the bug. it was this part here:
    If Bullet_Y[n]>=Zombie_Top and Bullet_Y[n]<=Zombie_Bottom and Bullet_X[n]<=Zombie_Right[Z] and Bullet_X[n]>=Zombie_Left[Z] Then 
    Shapes.Remove(Bullet[n]) Bullet_Impact_X=Bullet_X[n]
    Bullet_Impact_Y=Bullet_Y[n]
    Zombie_HP[Z]=Zombie_HP[Z]-20
    BloodEmitter() Bullet_Y[n]=-1000
    Bullet_X[n]=-1000
    endif
    i removed this part here:
    and Bullet_Y[n]<=Zombie_Bottom
    and it worked great.
    i really dont get why this didnt work! and this can just be a temporary fix...

    the bullets spawn at Player_CX (center x) and Player_CY (center y) but somehow the CY coordinate is lower than the zombie bottom, even when the buttons spawn higher than the zombie bottom.. wtf???? (the zombie_bottom is about 100 to high. idk why...) i hope you guys know what i mean. or just replace your code with this one here: HTR467 and compare the coordinates in the textwindow...

    i hope someone can tell me whats the matter...
    Live for nothing, OR CODE FOR SOMETHING!
    • Marked as answer by Dudeson Sunday, October 11, 2009 10:45 PM
    Friday, October 2, 2009 10:00 PM
  • nvm. i solved it..
    Live for nothing, OR CODE FOR SOMETHING!
    • Marked as answer by Dudeson Sunday, October 11, 2009 10:47 PM
    Sunday, October 11, 2009 10:47 PM