Main
import java.awt.Image;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
PImage gawd;
PImage god;
PImage lt33;
void setup() {
size(500, 500);
background(50);
scene1();
gawd = loadImage("gawd.png");
god = loadImage("god.png");
image(god, -230, -110);
lt33 = loadImage("33.jpg");
welcomeMessage();
}
void draw() {
fill(0);
rect(0, 0, width, 30);
fill(255);
textAlign(CENTER);
text("MouseX: "+mouseX+" & "+ "MouseY: "+mouseY, 250, 20);
if (mousePressed==true) {
mousePressed();
//import player here
}
}
void welcomeMessage() {
textSize(20);
textAlign(CENTER);
text("Welcome... to... my CHALLENGE! My name is gawd, ", 250, 450);
text("nice to meet you! Now, click ME!", 250, 480);
}
void mousePressed() {
background(50);
scene1();
image(lt33, 0, 0);
}
void scene1() {
background(0);
}
void scene2() {
}
'
Player
public class player {
private int dx;
private int dy;
private int x = 40;
private int y = 60;
private int w;
private int h;
private Image image;
public player() {
loadImage();
}
private void loadImage() {
ImageIcon ii = new ImageIcon("player.png");
image = ii.getImage();
w = image.getWidth(null);
h = image.getHeight(null);
}
public void move() {
x += dx;
y += dy;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getWidth() {
return w;
}
public int getHeight() {
return h;
}
public Image getImage() {
return image;
}
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
dx = -2;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 2;
}
if (key == KeyEvent.VK_UP) {
dy = -2;
}
if (key == KeyEvent.VK_DOWN) {
dy = 2;
}
}
public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
dx = 0;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 0;
}
if (key == KeyEvent.VK_UP) {
dy = 0;
}
if (key == KeyEvent.VK_DOWN) {
dy = 0;
}
}
}
How do you import the player class into main.java?