markcornwell / spacewar

Javascript implementation of 1962 game Spacewar! originally developed for the PDP-1
MIT License
0 stars 0 forks source link

ships continue to fire missiles after they are destroyed #33

Closed markcornwell closed 4 years ago

markcornwell commented 4 years ago

As a consequence of changes made to address issue #32, support for touch buttons, this issue has been addressed. Moved missile firing into the update function on the ships, so that if a ship does not exist, no missiles can be fired.

I hesitated to do this at first, because now Missiles know about Ships and Ships know about missiles, collapsing a bit of the hierarchical structure we had earlier. But I didn't want to be too dogmatic -- maintaining the strict hierarchy seemed overly contrived. So I bit the bullet and allowed it. Now ships know that missiles exist and how to call their constructor, but nothing else. So it a fairly limited set of assumptions that ships are allowed to make about missiles.

Upshot is the problem has been fixed and so I am closing out this issue.