This site requires JavaScript, please enable it in your browser!
Greenfoot back
Ploppy
Ploppy wrote ...

2012/12/24

Problem

Ploppy Ploppy

2012/12/24

#
So i want to keep a count how many aliens i killed. Problem is that i kill the aliens by shooting them, meaning that each laser counts by itself which doesn't count the aliens killed in total, it just keeps restarting the counter. Is there a way i can count the alien deaths in total?
JimmyFake JimmyFake

2012/12/24

#
I would implement a Class "Score" ( or eventually Scoreboard) and declare the variable int score in it. Implement a method in Score like addScore(int points) and use this method in Laser: Like everytime a laser object collides with an alien, alien is killed and Score.addScore(5), for example.
actinium actinium

2012/12/25

#
actinium actinium

2012/12/25

#
actinium wrote...
here's a link.
Joy of code #16. These videos are really instructive.
danpost danpost

2012/12/25

#
I would like to know if you would want to display to the player how many have been killed or if you just want to hold the value internally.
You need to login to post a reply.