Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it crashes due to a NoMethodError #34

Open
pcp4711 opened this issue Sep 29, 2022 · 0 comments
Open

it crashes due to a NoMethodError #34

pcp4711 opened this issue Sep 29, 2022 · 0 comments

Comments

@pcp4711
Copy link

pcp4711 commented Sep 29, 2022

Hi,
am I too fast?

space-invaders-master/lib/space_invaders/game_objects/image_objects/ship.rb:100:in block in retarget_gun!': undefined method x' for nil:NilClass (NoMethodError)

    bullet.target = @enemies.find(bullet.target.x)
                                               ^^
from space-invaders-master/lib/space_invaders/game_objects/image_objects/ammo.rb:52:in `block in bullets_without_target'
from space-invaders-master/lib/space_invaders/game_objects/image_objects/ammo.rb:52:in `each'
from space-invaders-master/lib/space_invaders/game_objects/image_objects/ammo.rb:52:in `bullets_without_target'
from space-invaders-master/lib/space_invaders/game_objects/image_objects/ship.rb:99:in `retarget_gun!'
from space-invaders-master/lib/space_invaders/game_objects/image_objects/ship.rb:71:in `draw'
from space-invaders-master/lib/space_invaders/scenes/main_scene.rb:50:in `each'
from space-invaders-master/lib/space_invaders/scenes/main_scene.rb:50:in `draw'
from space-invaders-master/lib/space_invaders/game.rb:21:in `draw'
from /usr/local/lib/ruby/gems/3.1.0/gems/gosu-1.4.3/lib/gosu/patches.rb:64:in `tick'
from lib/space_invaders.rb:6:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant