public float getAcceleration(HumptyDumpty humptyDumpty) { float baseAccelerationFactor = 90f; Random random = new Random(); int value = humptyDumpty.Level; switch (value) // humptyDumpty.Level { case 5: baseAccelerationFactor = 22; break; case 4: baseAccelerationFactor = 30; break; case 3: baseAccelerationFactor = 33; break; case 2: baseAccelerationFactor = 37; break; case 1: baseAccelerationFactor = 40; break; default: baseAccelerationFactor = 20; break; } return(baseAccelerationFactor + GameScreen.positiveOrNegative() * (float)(random.NextDouble() + 1)); }
public Projectile(TextureHandler t, HumptyDumpty humptyDumpty) { setDestination(humptyDumpty.Position); hitbox = new Rectangle((int)position.X, (int)position.Y, 10, 10); trajectory = new Rectangle((int)position.X, (int)position.Y, 2, 100); this.humptyDumpty = humptyDumpty; Random r = new Random(); projectileType = (ProjectileType)r.Next(7); texture = t.getProjectile(projectileType); }
public void Update(GameTime gameTime, HumptyDumpty humptyDumpty) { elapsedLifeSpanInSeconds += gameTime.ElapsedGameTime.Milliseconds; if (this.humptyDumpty == null) { this.humptyDumpty = humptyDumpty; } if (elapsedLifeSpanInSeconds > secondsToWait * 1000) { hitbox.X = (int)position.X; hitbox.Y = (int)position.Y; if (hitbox.Intersects(humptyDumpty.hitbox)) { humptyDumpty.Status = HumptyDumpty.DEAD; } setPosition(); rotation += getAcceleration(humptyDumpty) / 150.0F; } }
public float getAcceleration(HumptyDumpty humptyDumpty) { float baseAccelerationFactor = 90f; Random random = new Random(); int value = humptyDumpty.Level; switch (value) // humptyDumpty.Level { case 5: baseAccelerationFactor = 22; break; case 4: baseAccelerationFactor = 30; break; case 3: baseAccelerationFactor = 33; break; case 2: baseAccelerationFactor = 37; break; case 1: baseAccelerationFactor = 40; break; default: baseAccelerationFactor = 20; break; } return baseAccelerationFactor + GameScreen.positiveOrNegative() * (float)(random.NextDouble() + 1); }
public void Update(GameTime gameTime, HumptyDumpty humptyDumpty) { elapsedLifeSpanInSeconds += gameTime.ElapsedGameTime.Milliseconds; if (this.humptyDumpty == null) this.humptyDumpty = humptyDumpty; if (elapsedLifeSpanInSeconds > secondsToWait * 1000) { hitbox.X = (int)position.X; hitbox.Y = (int)position.Y; if (hitbox.Intersects(humptyDumpty.hitbox)) { humptyDumpty.Status = HumptyDumpty.DEAD; } setPosition(); rotation += getAcceleration(humptyDumpty) / 150.0F; } }
public King(TextureHandler t, HumptyDumpty h) { humptyDumpty = h; textureHandler = t; Initialize(); }