Jump to content

Hi guys!

Iv'e been trying some Java for the first time and i cant figure it out!

Can someone tell my why e isn't resolved?

Thanks in advance!

 

 

 

package deafualt_package;
 
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
 
public class gameLoop extends Applet implements Runnable, KeyListener{
 
public int x, y;
public Image offscreen;
public Graphics d; 
public boolean up, down, left, right;
public void run() {
x = 100;
y = 100;
while(true){
if (left == true){
x--;
}
repaint();
try {
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
 
public void keyPressed(KeyEvent arg0) {
if (e.getKeyCode() == 37){
left = true;
}
}
 
public void keyReleased(KeyEvent arg0) {
if (e.getKeyCode() == 37){
left = true;
}
}
 
public void keyTyped(KeyEvent arg0) {
 
}
 
}
 
Link to comment
https://linustechtips.com/topic/262382-cant-resolve-java-arguments/
Share on other sites

Link to post
Share on other sites

I'm asking this because I'm a beginner, I barely understood what I did. But thanks! I'm going to look that up.

Code tags are used when posting code on the forum.

 

Use the blue < > symbol above where you write your posts or manually add them around your code when you make your posts like so

[code]// code between the tagspublic class Example {}[/code]
Link to post
Share on other sites

 

Code tags are used when posting code on the forum.

 

Use the blue < > symbol above where you write your posts or manually add them around your code when you make your posts like so

[code]// code between the tagspublic class Example {}[/code]

Ohh, i thought that it was some sort of a Java command or something. Thanks!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×