My student is creating a shooter game for his final project and we were able to get the bullets to shoot, but we cannot get it to score or change the animation. We’ve tried everything. Please help.
your redeclaring your group variable within the bullet scope
function fire() {
var bullet = createSprite(jet.x, jet.y - 50);
bullet.setAnimation("bullets");
bullet.velocityY = -25;
bullet.lifetime=100;
bullets.add(bullet);
}
by using bullet
instead of bullets
you can successfully add the bullet to your sprite group to use for collisions such as .collide
which is what you seem to be checking to make sure the bullets hit.