hallo,
ik ben vrij nieuw met Java en ben bezig met een spelletje, maar ik krijg een compile error die ik niet kan oplossen. ik heb ook al op internet gezocht maar kon niets vinden.
de error is:
fg.java:
[JS]import java.awt.*;
import java.applet.*;
public class fg extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
Engine.GameObject obj;
public void init() {
obj= new Engine.GameObject();
Engine.Components.Component cmp=new Engine.Components.Component(obj);
obj.Components[0]=cmp;
obj.components.addComponent(cmp);
// TODO start asynchronous download of heavy resources
}
public void paint(Graphics g) {
g.drawString(obj.Components.length+"",20,20);
}
}[/JS]
en Engine.java:
[JS]public class Engine
{
public static class GameObject
{
public Engine.Components.Component[] Components= new Engine.Components.Component[1] ;
public static class components
{
public static void addComponent(Engine.Components.Component comp)
{
}
}
public GameObject()
{
}
}
public static class Components
{
public static class Component
{
public boolean enabled=true;
public GameObject gameObject;
public Component(Engine.GameObject owner)
{
this.gameObject=owner;
}
}
public static class Camera extends Component
{
public Camera(GameObject owner)
{
super(owner);
}
}
}
}[/JS]
ik heb al veel dingen geprobeerd maar dan krijg ik vaak juist méér errors...
kan iemand mij hiermee helpen?
mvg rowano
ik ben vrij nieuw met Java en ben bezig met een spelletje, maar ik krijg een compile error die ik niet kan oplossen. ik heb ook al op internet gezocht maar kon niets vinden.
de error is:
Code:
--------------------Configuration: game engine - JDK version 1.7.0 <Default> - <Default>--------------------
C:\Documents and Settings\*****\Mijn documenten\JCreator LE\MyProjects\game engine\fg.java:24: error: unexpected type
obj.components.addComponent(cmp);
^
required: class,package
found: variable
1 error
Process completed.
fg.java:
[JS]import java.awt.*;
import java.applet.*;
public class fg extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
Engine.GameObject obj;
public void init() {
obj= new Engine.GameObject();
Engine.Components.Component cmp=new Engine.Components.Component(obj);
obj.Components[0]=cmp;
obj.components.addComponent(cmp);
// TODO start asynchronous download of heavy resources
}
public void paint(Graphics g) {
g.drawString(obj.Components.length+"",20,20);
}
}[/JS]
en Engine.java:
[JS]public class Engine
{
public static class GameObject
{
public Engine.Components.Component[] Components= new Engine.Components.Component[1] ;
public static class components
{
public static void addComponent(Engine.Components.Component comp)
{
}
}
public GameObject()
{
}
}
public static class Components
{
public static class Component
{
public boolean enabled=true;
public GameObject gameObject;
public Component(Engine.GameObject owner)
{
this.gameObject=owner;
}
}
public static class Camera extends Component
{
public Camera(GameObject owner)
{
super(owner);
}
}
}
}[/JS]
ik heb al veel dingen geprobeerd maar dan krijg ik vaak juist méér errors...
kan iemand mij hiermee helpen?
mvg rowano