public Color textcolor; //render color (color + opacity) public GRPlusScoreObj(float score, GRPlayer player) { plusscorestring = "+" + (int)score; position = player.position; offset = Vector2.Zero; opacity = 255; TTL = startingTTL; }
public GRWaveHoming(int wavenum, Rectangle gamearea, Texture2D waveTex, Color cColor, GRPlayer player) { linedirection = 0; this.wavetime = 0; this.player = player; this.wavenum = wavenum; this.gamearea = gamearea; this.waveTex = waveTex; bullets = new ArrayList(); rand = new Random(); bulletspawntimer = 0; //Create and init bullets spawnBullet(cColor); }
public void Update(GameTime gTime, GRPlayer player) { for (int index = 0; index < scoreObjs.Count; index++) { GRPlusScoreObj cScore = (GRPlusScoreObj)scoreObjs[index]; cScore.offset.Y += (float)gTime.ElapsedGameTime.TotalSeconds * GRPlusScoreObj.offsetacc; cScore.position += cScore.offset; //fade score out over time (currently lerp) cScore.opacity = 1.0f - ((GRPlusScoreObj.startingTTL - cScore.TTL) / GRPlusScoreObj.startingTTL); //remove if dead cScore.TTL -= (float)gTime.ElapsedGameTime.TotalSeconds; if (cScore.TTL <= 0) { scoreObjs.RemoveAt(index); index--; } } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here triTx = Content.Load <Texture2D>("power35"); gameareaborder = Content.Load <Texture2D>("border"); bulletTextures50.Add(Content.Load <Texture2D>("Shapes/square50")); bulletTextures50.Add(Content.Load <Texture2D>("Shapes/pent50")); bulletTextures50.Add(Content.Load <Texture2D>("Shapes/hex50")); bulletTextures50.Add(Content.Load <Texture2D>("Shapes/circle50")); bulletTextures25.Add(Content.Load <Texture2D>("Shapes/square25")); bulletTextures25.Add(Content.Load <Texture2D>("Shapes/pent25")); bulletTextures25.Add(Content.Load <Texture2D>("Shapes/hex25")); bulletTextures25.Add(Content.Load <Texture2D>("Shapes/circle25")); whitepx = Content.Load <Texture2D>("whitepx"); pixelfont24 = Content.Load <SpriteFont>("04b03_24"); pixelfontlarge = Content.Load <SpriteFont>("04b03_large"); grazesfx = Content.Load <SoundEffect>("grazewav"); explosionsfx = Content.Load <SoundEffect>("rad"); slowmosfx = Content.Load <SoundEffect>("slowmo"); newwavesfx = Content.Load <SoundEffect>("newwave"); grazebgm = Content.Load <Song>("Space Fighter Loop"); //set player Tx player = new GRPlayer(gamearea, Content); player.position = new Vector2(gamearea.Center.X, gamearea.Center.Y); player.setTex(triTx); //construct first wave setWave(); MediaPlayer.Volume = BGM_VOLUME; MediaPlayer.IsRepeating = true; MediaPlayer.Play(grazebgm); }
public void addScore(float score, GRPlayer player) { scoreObjs.Add(new GRPlusScoreObj(score, player)); }