Package ru.vagrant_ai.questionmarkgame.obj.particle

Source Code of ru.vagrant_ai.questionmarkgame.obj.particle.LightSourceLow

package ru.vagrant_ai.questionmarkgame.obj.particle;

import java.util.Random;

import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;

import ru.vagrant_ai.questionmarkgame.util.Util;
import ru.vagrant_ai.questionmarkgame.util.list.PT;

public class LightSourceLow extends Particle {

  Image[] util_img = new Image[4];
  Color col = new Color(250,250,250,new Random().nextInt(5)*new Random().nextInt(7)+35);
  private byte util_frame;
  private byte util_iter1 = 12;
  private byte util_iter2 = 5;
  private short x, y;
 
  public LightSourceLow(int x, int y)
  {
    id = PT.LIGHT_SOURCE_LOW;
   
    for (int i = 0; i < 4; ++i)
      util_img[i] = Util.loadImage("particle/light/light_source_low_000"+i+".png");
    util_frame = 3;
    this.x = (short) x;
    this.y = (short) y;
  }
 
  public void update()
  {
    util_iter1--;
    if (util_iter1 < 1)
    {
      util_iter1 = 12;
      util_frame++;
      if (util_frame > 3)
        util_frame = 0;
    }
   
    util_iter2--;
    if (util_iter2 < 1)
    {
      util_iter2 = 5;
      col = new Color(250,250,250,new Random().nextInt(5)*new Random().nextInt(6)+35);
    }
  }
 
  public void render(Graphics g)
  {
    util_img[util_frame].draw(x, y);
    g.setColor(col);
    g.fillOval(x-14, y-21, 55, 55);
  }

}
TOP

Related Classes of ru.vagrant_ai.questionmarkgame.obj.particle.LightSourceLow

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.