vb.net - Wall Defense game with some issues -


i building wall defense game using vb.net. have gotten quite bit accomplished far have 1 major issue , several minor ones can use with.

my major issue this, bad guys supposed damage wall run it. of right don't , unsure why damage not being subtracted wall health. have both bad guys , wall set new class made, yes know haven't used attributes created, called character.

next minor issues these. a) player movement seems blur upon moving him left or right. b) can't player fire more 1 attack @ time. there can 1 missile on screen @ time. when add more missiles slows movement complete stop. c) have tried getting bad guys close wall possible count hit when move them closer game locks down.

i have added code here, ideas or appreciated!

    option explicit on     option strict on     option infer off  public class form1 public class character     private _inthealth integer     private _intdamage integer     private _intspeed integer     private _blnranged boolean      public property health integer                     return _inthealth         end         set(value integer)             if value > 0                 _inthealth = value             else                 _inthealth = 0             end if         end set     end property     public property damage integer                     return _intdamage         end         set(value integer)             if value > 0                 _intdamage = value             else                 _intdamage = 0             end if         end set     end property     public property speed integer                     return _intspeed         end         set(value integer)             if value > 0                 _intspeed = value             else                 _intspeed = 0             end if         end set     end property     public property ranged boolean                     return _blnranged         end         set(value boolean)             _blnranged = value         end set     end property      public sub new()         _inthealth = 0         _intdamage = 0         _intspeed = 0         _blnranged = false     end sub      public sub new(byval health integer, damage integer, speed integer, ranged boolean)         _inthealth = health         _intdamage = damage         _intspeed = speed         _blnranged = ranged     end sub end class dim pictest(10) picturebox ' images bad guys dim badtest(10) character  ' values bad guys dim goodwall character dim collision boolean      ' check impact guy , bad guy (can modified) dim newpos point           ' used move our guy around arrow keys dim newshot point          ' used center shot on knights image dim pbxmissle new picturebox 'used missle fired guy dim chrmissle new character ' missle attibutes  dim intbadcount integer  private sub form1_keydown(sender object, e system.windows.forms.keyeventargs) handles me.keydown     if collision = false         select case e.keycode             case keys.right                 if pbxbow.location.x < 1125                     newpos.y = pbxbow.location.y                     newpos.x = pbxbow.location.x + 8                 end if             case keys.left                 if pbxbow.location.x > 4                     newpos.y = pbxbow.location.y                     newpos.x = pbxbow.location.x - 8                 end if             case keys.space                 newshot.y = pbxbow.location.y                 newshot.x = pbxbow.location.x + 30                 pbxmissle.location = newshot                 pbxmissle.visible = true                 chrmissle = new character(0, 10, 10, false)         end select         pbxbow.location = newpos     end if end sub  private sub form1_load(sender object, e eventargs) handles me.load     dim intk integer = 10 ' mess, setting things in load event      timer1.enabled = false     intj integer = 0 10         pictest(intj) = new picturebox         pictest(intj).height = 128         pictest(intj).width = 75         pictest(intj).left = intk         pictest(intj).top = 25         pictest(intj).image = project_2.my.resources.resources.knight3a          pictest(intj).visible = false         pictest(intj).enabled = true          pbxmissle.height = 10         pbxmissle.width = 5         pbxmissle.backcolor = color.black         pbxmissle.location = pbxbow.location         pbxmissle.visible = false         controls.add(pbxmissle)         controls.add(pictest(intj))         badtest(intj) = new character(10, 10, 1, false)         goodwall = new character(100, 0, 0, false)         intk += 100     next intj end sub private sub timer1_tick(sender object, e eventargs) handles timer1.tick     timer1.interval = 500     ' collision detection     if collision = false         intbadcount = 11 ' countdown game on          if pbxmissle.visible = true 'moves missle before check collision             pbxmissle.location = new point(pbxmissle.left, pbxmissle.top - chrmissle.speed)         end if          inti integer = 0 10             if pictest(inti).visible = true                 if pictest(inti).bounds.intersectswith(pbxwall.bounds) ' checks collision knight , wall                     goodwall.health = goodwall.health - badtest(inti).damage                     if goodwall.health = 0                         pbxbow.enabled = false                         timer1.stop()                         messagebox.show("game over", "game over", messageboxbuttons.ok)                         'exit                     end if                 elseif pictest(inti).bounds.intersectswith(pbxmissle.bounds) ' checks collision missle , bad guys                     pictest(inti).visible = false                     pbxmissle.visible = false                  elseif pictest(inti).bottom < pbxwall.top - 45 ' moves bad guys based on speed if not @ bottom                     pictest(inti).location = new point(pictest(inti).left, pictest(inti).top + badtest(inti).speed)                 else                     pictest(inti).location = new point(pictest(inti).left, 25) ' moves bad guy top                 end if             end if             if pictest(inti).visible = false ' if bad guy hit missle visible set false counts how many have been hit                 intbadcount -= 1             end if             if intbadcount = 0 'check remaining bad guys. 11 in array if visible false winner                 timer1.stop()                 messagebox.show("you won!" & vbnewline & "all enemies defeated!", "game over", messageboxbuttons.ok)              end if         next inti     end if end sub  private sub starttoolstripmenuitem1_click(sender object, e eventargs) handles starttoolstripmenuitem1.click     dim intz integer = 10 ' resets game board new game after win, loss or first start     dim intrandom new random     timer1.enabled = false     intreset integer = 0 10         pictest(intreset).height = 128         pictest(intreset).width = 75         pictest(intreset).left = intz         pictest(intreset).top = intrandom.next(-300, 25)         pictest(intreset).image = project_2.my.resources.resources.knight3a ' can sub image ***********          pictest(intreset).visible = false         pictest(intreset).enabled = true         controls.add(pictest(intreset))         badtest(intreset).speed = intrandom.next(10, 50)         intz += 100     next intreset      intl integer = 0 10         pictest(intl).visible = true     next     pbxbow.top = 559     pbxbow.left = 559     refresh()     collision = false     timer1.enabled = true end sub end class 

first: sure damage bigger 0

goodwall.health = goodwall.health - badtest(inti).damage 

second: sure health not smaller 0

 if goodwall.health = 0 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -