public override void HandleCollision(CollisionDirection cd, PhysicsAble entity) { if (entity is Bullet) { bulletRef = (Bullet)entity; bulletRef.attach(this); } else if (entity is Level) { velocity = Vector2.Zero; } else { base.HandleCollision(cd, entity); } }
public void fireBullet(Vector2 velocity) { if (bulletRef == null) return; bulletRef.refire(this, velocity); bulletRef = null; }
public void createBullet(int posX, int posY, Vector2 velocity) { Bullet b = new Bullet(context, new Vector2(posX, posY), velocity); addEntity(200, b, b.id); StateChange sc = StateChangeFactory.createEntityStateChange(b.id, posX, posY, Bullet.frameWidth, b.GetFrameTime(), Bullet.textureName, b.scale, 200); changes.Add(sc); }