Help color wont turn random [message #1856955] |
Tue, 10 January 2023 17:26  |
Eclipse User |
|
|
|
Hi so basically im doing a rectangular game when the box hit the corners it changes color and the random is marked red in eclipse and i dont know why
package main;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Random;
import javax.swing.JPanel;
import inputs.KeyboardInputs;
import inputs.MouseInputs;
public class GamePanel extends JPanel{
private MouseInputs mouseInputs;
private float xDelta = 100, yDelta = 100;
private float xDir = 0.01f, yDir = 0.01f;
private int frames = 0;
private long lastCheck =0;
private Color color = new Color(150,20,90);
private Random random;
public GamePanel() {
random = new Random;
mouseInputs = new MouseInputs(this);
addKeyListener(new KeyboardInputs(this));
addMouseListener(mouseInputs);
addMouseMotionListener(mouseInputs);
|
|
|
|
Powered by
FUDForum. Page generated in 0.06511 seconds