This site requires JavaScript, please enable it in your browser!
Greenfoot back
uncfan44
uncfan44 wrote ...

2016/4/25

creating a guided game about computer parts for kids

uncfan44 uncfan44

2016/4/25

#
this is a "game" although realizing in my class we are not learning enough to complete my vision. i have since altered it from a game to more of a guided tutorial. so far i have 4 worlds. 1 that is really just an intro, 1 that i will use to explain whats going on with a black screen and text boxes. The final 2 are the more important; one i want to use to introduce the main computer components and the other to drag and drop them over to a computer tower. after each part has been dragged i want a congratz message to display when the actor that was dragged touches the tower. I was wondering 2 things... one is can an actor be in the world 3 (we can call it for now) and react to a mouse hover by displaying a text box detailing what it is, then in the next world (4) it moves when the mouse is dragged? the other is when i move the computer components when the mouse using if (Greenfoot.mouseDragged(this)) { World world = getWorld(); MouseInfo mi = Greenfoot.getMouseInfo(); world.removeObject(this); world.addObject(this, mi.getX(), mi.getY()); return; } the actors drag over the other actors, subclasses under the computer parts actor, they go over them; but when they go over an actor (tower) which is a subclass of actor not computerparts class they go behind. essentially they are hiding behind the tower when i drop them. in reality id like them to go on top. once i figure these 2 out i will be almost done with my scenario. thanks in advance for any help i can receive!
valdes valdes

2016/4/25

#
The answer for the second issue. The class World has a method setPaintOrder(Java.lang.Class...) to solve that issue. In the constructor of your world, put:
1
this.setPaintOrder(Parts.class, Tower.class);
so the parts are on top of the tower. If you have more classes, add them with commas in the parameter.
uncfan44 uncfan44

2016/4/25

#
thanks, @valdes! i will try this when im off work!
uncfan44 uncfan44

2016/4/25

#
also is there a way to launch a new world when every actor in my computer parts class(example memory is a subclass of computerparts which is a subclass of actor class) has been placed over my tower class. ideally i'd like the game to go to a final screen thanking them then the scenario end.
valdes valdes

2016/4/25

#
For the first issue, check out the Greenfoot.mouseMoved(java.lang.Class) method. You can put it on an if-else statement, if true, draw the message, if not, remove the message. For the last issue, perhaps you can use the method isTouching(java.lang.Class) or the method getIntersectingObjects(java.lang.Class) in the Actor class. From the Tower class you put something like this:
1
2
3
4
5
6
7
if (isTouching(Memory.class) && isTouching(Mouse.class) && isTouching(Whatever.class)) { //all subclasses of ComputerParts
//end the game
}
// or
if (getIntersectingObjects(ComputerParts.class).size() == number_parts) { //quantity of parts
// end the game
}
First one checks if the Tower actor is touching an instance of every class in computerparts. Second one gets a List of all computerparts objects touching the tower. With size() you get how many are there. If the quantity is a fixed number, it will work.
danpost danpost

2016/4/25

#
valdes wrote...
For the first issue, check out the Greenfoot.mouseMoved(java.lang.Class) method.
The method mentioned here does not exist -- it is Greenfoot.mouseMoved(Object object), where the object is an Actor object or a World object (or null -- no specified object). A 'Class' is an object, but the implementation of the method does not deal with it and will always return 'false'.
You can put it on an if-else statement, if true, draw the message, if not, remove the message.
It would be better to detect changes in the hover state instead of just using the current state. That way you are not constantly building messages while the mouse is over the actor. This would require a boolean field to track the mouse hoving state:
1
2
3
4
5
6
7
8
9
// instance field
private boolean mouseOn;
 
// in act or method it calls
if (getWorld() instanceof World3 && Greenfoot.mouseMoved(null) && mouseOn != Greenfoot.mouseMoved(this))
{
    mouseOn = !mouseOn;
    if (mouseOn) showMessage(); else hideMessage();
}
Now, you can place the specific code to show and hide the message in their own methods ('showMessage' and 'hideMessage').
uncfan44 uncfan44

2016/4/26

#
so far this is what I got. it seems like when i hover over my actor nothing happens at all yet.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import greenfoot.*;
import java.awt.Color;
/**
 * Write a description of class BluerayDrive here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class BluerayDrive extends CompParts
{
    private boolean mouseOn;
    /**
     * Act - do whatever the BluerayDrive wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act()
    {
        // Add your action code here.
        clickee();
        mouseHover();
    }
    public void mouseHover()
    {
        if (getWorld() instanceof LivingRoom && Greenfoot.mouseMoved(null) && mouseOn != Greenfoot.mouseMoved(this))
        {
         mouseOn = !mouseOn;
        if (mouseOn) showMessage(); else hideMessage();
        }
 
      }
    public void showMessage()
    {
      GreenfootImage brinfo = new GreenfootImage("A bluray drive is where you would put and cd's, dvd's, or bluray", 100, Color.black, Color.white); 
    }
    public void hideMessage()
    {
         
    }
    
}
didnt do hide cause im not sure what i should put there.
danpost danpost

2016/4/26

#
Well, so far, the 'showMessage' method is only creating an image. It is not being given to an actor to be added into the world or drawn on the background of the world -- so, it will not show yet. It would be best to give it to an actor and add the actor into the world so removing the actor will remove the message (you really do not want to mess with the background image of the world). You might want to add an instance reference field to retain the actor that shows the message so it can be removed easily and does not have to be recreated every time the mouse comes over the part. I noticed that you are placing the code in the classes of the individual parts. This is really not needed. You can place code that is similar to all subclasses of CompParts in the CompParts class so all subclasses can share the code from one location. The only thing that would be different is the message to display which is a String object. You can declare a field for the strings in the CompParts class and assign it their values from the individual parts classes or from the LivingRoom class when you create them.
uncfan44 uncfan44

2016/4/26

#
i have placed the actor in the world already here is the code from the world
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
private void prepare()
{
    Motherboard motherboard = new Motherboard();
    addObject(motherboard, 891, 114);
    Videocard videocard = new Videocard();
    addObject(videocard, 724, 124);
    Memory memory = new Memory();
    addObject(memory, 582, 125);
    PowerSupply powersupply = new PowerSupply();
    addObject(powersupply, 459, 132);
    BluerayDrive blueraydrive = new BluerayDrive();
    addObject(blueraydrive, 334, 127);
    Harddrive harddrive = new Harddrive();
    addObject(harddrive, 217, 139);
    Tower tower = new Tower();
    addObject(tower, 672, 506);
    tower.setLocation(181, 545);
    tower.setLocation(151, 543);
i just was hoping that when the mouse moved over the object the image with the text box would pop up and then disappear after removing the mouse. there is so far these objects in the world with processor not being added yet. each image i would like a pop up to flash just above the pic of the actor while the mouse is over it. after each actor has been read about the player will move on via hitting enter again(which is how they got to this world in the first place.
danpost danpost

2016/4/26

#
uncfan44 wrote...
i just was hoping that when the mouse moved over the object the image with the text box would pop up and then disappear after removing the mouse. there is so far these objects in the world with processor not being added yet. each image i would like a pop up to flash just above the pic of the actor while the mouse is over it. after each actor has been read about the player will move on via hitting enter again(which is how they got to this world in the first place.
I know what you are wanting as far as the text boxes and proceeding to the next world. The following is a simple mock of the different things you want. It is what I came up with to create the behavior you are wanting. The first world class (called 'Here"):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import greenfoot.*;
 
public class Here extends World
{
    public Here()
    {
        super(800, 600, 1);
         
        // the blue dot
        Dot blueDot = new BlueDot();
        blueDot.setDescription("I am large.\nI am round.\nI am blue.\nI am a dot.");
        addObject(blueDot, 200, 300);
         
        // the red dot
        Dot redDot = new RedDot();
        redDot.setDescription("I am large.\nI am round.\nI am red.\nI am a dot.");
        addObject(redDot, 600, 300);
         
        // draw instructions at top of screen
        GreenfootImage instruct = new GreenfootImage("Hover over these with the mouse", 36, null, null);
        getBackground().drawImage(instruct, (getWidth()-instruct.getWidth())/2, 15);
         
        // draw instructions at bottom of screen
        instruct = new GreenfootImage("Press enter to proceed", 36, null, null);
        getBackground().drawImage(instruct, (getWidth()-instruct.getWidth())/2, getHeight()-40);
    }
     
    public void act()
    {
        if (Greenfoot.isKeyDown("enter")) Greenfoot.setWorld(new There()); // proceed to next world
    }
}
The main parts are the lines between 8 and 18 and the act method. Next the other world (called 'There')
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import greenfoot.*;
 
public class There extends World
{
    public There()
    {
        super(800, 600, 1);
        // the dots
        addObject(new RedDot(), 400, 200);
        addObject(new BlueDot(), 400, 400);
         
        // draw instructions at top of screen
        GreenfootImage instruct = new GreenfootImage("Drag these with the mouse", 36, null, null);
        getBackground().drawImage(instruct, (getWidth()-instruct.getWidth())/2, 15);
    }
}
Pretty much inconsequential for a world class. Next, we have the superclass (like your CompParts class) for grouping a family of actors (called 'Dot'):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import greenfoot.*;
 
public class Dot extends Actor
{
    Actor textbox; // actor to display the description
    boolean mouseOn; // to track the hover state
     
    /** used to set up an actor to display a message when hovered on */
    public void setDescription(String text)
    {
        GreenfootImage textImage = new GreenfootImage(text, 28, null, null); // creates imagee with the given text
        int biggerWidth = textImage.getWidth()+20;
        int biggerHeight = textImage.getHeight()+16;
        GreenfootImage image = new GreenfootImage(biggerWidth, biggerHeight); // creates a larger image
        image.drawRect(0, 0, image.getWidth()-1, image.getHeight()-1); // draws frame on larger image
        int drawX = (image.getWidth()-textImage.getWidth())/2;
        int drawY = (image.getHeight()-textImage.getHeight())/2;
        image.drawImage(textImage, drawX, drawY); // draws text image on larger image
        textbox = new SimpleActor(); // creates the textbox actor to show the image
        textbox.setImage(image); // gives image to textbox actor
    }
     
    /** actions for both worlds */
    public void act()
    {
        if (getWorld() instanceof Here && // for the Here world
            textbox != null && // is there a textbox object to show
            Greenfoot.mouseMoved(null) && // did the mouse move
            mouseOn != Greenfoot.mouseMoved(this)) // is mouse changing between being on and off the actor
        {
            mouseOn = !mouseOn; // update saved state
            if (mouseOn) // hover beginning
            {
                getWorld().addObject(textbox, getX(), getY()-180); // show textbox
            }
            else // hover ending
            {
                getWorld().removeObject(textbox); // hide textbox
            }
        }
        if (getWorld() instanceof There) // for the There world
        {
            if (Greenfoot.mousePressed(this)) // gets focus
            {
                // get location and world actor is in so it can be removed and added back in at the same place
                // (this is undocumented behavior to have dragged object painted over others in the world)
                int x = getX();
                int y = getY();
                World world = getWorld();
                world.removeObject(this);
                world.addObject(this, x, y);
            }
            if (Greenfoot.mouseDragged(this)) // is the actor being dragged
            {
                MouseInfo mouse = Greenfoot.getMouseInfo();
                setLocation(mouse.getX(), mouse.getY()); // keep actor with mouse
            }
        }
    }
}
That is where most, if not all, of the important code is located (although it has only two fields and two methods). The subclasses (like your individual parts) have no code of any significance (these are called 'BlueDot' and 'RedDot'):
1
2
3
4
5
6
7
8
9
10
11
12
13
import greenfoot.*;
 
public class BlueDot extends Dot
{
    public BlueDot()
    {
        // create and set the imagee of this actor
        GreenfootImage image = new GreenfootImage(150, 150);
        image.setColor(java.awt.Color.blue);
        image.fillOval(0, 0, 150, 150);
        setImage(image);
    }
}
and
1
2
3
4
5
6
7
8
9
10
11
12
13
import greenfoot.*;
 
public class RedDot extends Dot
{
    public RedDot()
    {
        // create and set the image of this actor
        GreenfootImage image = new GreenfootImage(150, 150);
        image.setColor(java.awt.Color.red);
        image.fillOval(0, 0, 150, 150);
        setImage(image);
    }
}
Finally, a simple actor class for the textbox objects (called 'SimpleActor'):
1
2
/** a simple actor class */
public class SimpleActor extends greenfoot.Actor {}
That is the code for the entire project. You can create a new scenario, create the classes needed and copy/paste the codes into each one and test it out. However, you should be able to just look it over as it is well documented and not that difficult to understand.
uncfan44 uncfan44

2016/4/27

#
wow man this was awesome, will add later tonite and report back! this was explained and broken down extremely well! i cant thank you enough for the help. was stuck at the text boxes super hard and didnt know where to turn. have a few more things to add before its due next week, but i already had those figured out.
uncfan44 uncfan44

2016/4/27

#
ok i updated everything, i am going to post the code to show you what i have. the text boxes do not come up. when i built the scenario exactly like you did it worked. so i added yellow and green dots just to make sure i understood it all. everything worked fine. I copy and pasted what i could, retyped what was easier into my premade scenario and its not working. i commented out everything i had in there that would conflict and still not displaying them. first is the code for my LivingRoom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
mport greenfoot.*;
 
/**
 * This is our first prototype.  Eventually this will have multiple cut scenes leading into the game, and
 * possibly even cut scenes after each successful placement of a part.
 *
 * //Tristan Walker
 * //Version 4.0
 */
public class LivingRoom extends World
{
    GreenfootSound backgroundMusic = new GreenfootSound("Doug.mp3");
 
    /**
     * in this world we will be building a computer and learning the very basics about computer parts
     * and their over all importance in the build of a computer.
     *
     */
    public LivingRoom()
    {   
        //
        super(1080, 607, 1);
        //addObject(new Motherboard(),1003,537);
        //addObject(new Harddrive(),877,505);
        //addObject(new PowerSupply(),872,571);
        //addObject(new Memory(),772,492);
        //addObject(new BluerayDrive(),785,579);
        //addObject(new Videocard(),652,568);
        backgroundMusicstop();
        //prepare();
         
        CompParts processor = new Processor();
        processor.setDescription("I am a CPU or a central processing unit.\nI control everything about the computer.\nI am the brains.");
        addObject(processor, 95, 219);
          
        // the red dot
        CompParts harddrive = new Harddrive();
        harddrive.setDescription("I am a Harddrive.\nI store all of your stuff.\nThink of me like a toy chest\nbut much smaller.");
        addObject(harddrive, 207, 214);
         
        //the yellow dot
        CompParts blueraydrive = new BluerayDrive();
        blueraydrive.setDescription("I am a blueray or disk drive .\nI am where you put all types of disk.\nI help you install stuff.\nOr I can play your movie for you.");
        addObject(blueraydrive, 333, 215);
         
        //the green dot
        CompParts powerSupply = new PowerSupply();
        powerSupply.setDescription("I am you Power Supply.\nI get plugged into the wall.\nWithout me your computer doesn't come on.");
        addObject(powerSupply, 458, 217);
         
        // the blue dot
        CompParts memory = new Memory();
        memory.setDescription("I am your memory.\nMy friends call me RAM.\nI help your computer store stuff for a little while.\nIm like an quick stay hotel for your tasks.");
        addObject(memory, 589, 205);
          
        // the red dot
        CompParts videocard = new Videocard();
        videocard.setDescription("I am your Video Card.\nI help your computer display everything.\nYour monitor plugs into my backside.");
        addObject(videocard, 720, 215);
         
        //the yellow dot
        CompParts motherboard = new Motherboard();
        motherboard.setDescription("I am your Motherboard.\nEvery single piece plugs into me somehow.\nI am the foundation your computer is built from.\nYou kinda need me.");
        addObject(motherboard, 891, 187);
         
    }
    public void act()
    {
        beginGame();
          
         
    }
 
    /**
     * Prepare the world for the start of the program. That is: create the initial
     * objects and add them to the world.
     */
    private void prepare()
    {
        Motherboard motherboard = new Motherboard();
        addObject(motherboard, 891, 114);
        Videocard videocard = new Videocard();
        addObject(videocard, 724, 124);
        Memory memory = new Memory();
        addObject(memory, 582, 125);
        PowerSupply powersupply = new PowerSupply();
        addObject(powersupply, 459, 132);
        BluerayDrive blueraydrive = new BluerayDrive();
        addObject(blueraydrive, 334, 127);
        Harddrive harddrive = new Harddrive();
        addObject(harddrive, 217, 139);
        Tower tower = new Tower();
        addObject(tower, 672, 506);
        tower.setLocation(181, 545);
        tower.setLocation(151, 543);
        Processor processor = new Processor();
        addObject(processor, 98, 148);
        Instructions2 instructions2 = new Instructions2();
        addObject(instructions2, 474, 52);
        instructions2.setLocation(539, 31);
        Instructions3 instructions3 = new Instructions3();
        addObject(instructions3, 505, 247);
        instructions3.setLocation(535, 225);
        instructions3.setLocation(557, 291);
        instructions2.setLocation(784, 552);
        instructions2.setLocation(778, 571);
        processor.setLocation(95, 219);
        harddrive.setLocation(207, 214);
        blueraydrive.setLocation(333, 215);
        powersupply.setLocation(458, 217);
        memory.setLocation(589, 205);
        videocard.setLocation(720, 215);
        motherboard.setLocation(891, 187);
    }
 
    public void backgroundMusicstop()
    {
        backgroundMusic.stop();
    }
    void beginGame()
    {
        if (Greenfoot.isKeyDown("enter"))
        {
            Greenfoot.setWorld(new LetsBuild());
            Greenfoot.delay(15);
            backgroundMusic.stop();
        }
    }
}
next is my LetsBuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import greenfoot.*;
 
/**
 * Write a description of class LetsBuild here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class LetsBuild extends World
{
 
    /**
     * Constructor for objects of class LetsBuild.
     *
     */
    public LetsBuild()
    {   
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(1080, 607, 1);
 
        prepare();
    }
 
    /**
     * Prepare the world for the start of the program. That is: create the initial
     * objects and add them to the world.
     */
    private void prepare()
    {
        Tower2 tower2 = new Tower2();
        addObject(tower2, 816, 324);
        Videocard videocard = new Videocard();
        addObject(videocard, 90, 70);
        Memory memory = new Memory();
        addObject(memory, 90, 172);
        Harddrive harddrive = new Harddrive();
        addObject(harddrive, 90, 293);
        harddrive.setLocation(90, 270);
        PowerSupply powersupply = new PowerSupply();
        addObject(powersupply, 90, 364);
        BluerayDrive blueraydrive = new BluerayDrive();
        addObject(blueraydrive, 90, 442);
        Motherboard motherboard = new Motherboard();
        addObject(motherboard, 90, 539);
        Processor processor = new Processor();
        addObject(processor, 90, 322);
        blueraydrive.setLocation(90, 453);
        powersupply.setLocation(90, 397);
        memory.setLocation(90, 169);
        videocard.setLocation(90, 54);
        memory.setLocation(90, 152);
        harddrive.setLocation(90, 247);
        powersupply.setLocation(90, 328);
        processor.setLocation(90, 400);
    }
}
next is my CompParts Actor (my version of dot)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import greenfoot.*;
 
/**
 * Write a description of class CompParts here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class CompParts extends Actor
{
Actor textbox;  //using this guy to display the description
boolean mouseOn; //if the mouse is over my object or not
 
public void setDescription(String text)
{
    GreenfootImage textImage = new GreenfootImage(text, 28, null, null); // creates imagee with the given text
    int biggerWidth = textImage.getWidth()+20;
    int biggerHeight = textImage.getHeight()+16;
    GreenfootImage image = new GreenfootImage(biggerWidth, biggerHeight); // creates a larger image
    image.drawRect(0, 0, image.getWidth()-1, image.getHeight()-1); // draws frame on larger image
    int drawX = (image.getWidth()-textImage.getWidth())/2;
    int drawY = (image.getHeight()-textImage.getHeight())/2;
    image.drawImage(textImage, drawX, drawY); // draws text image on larger image
    textbox = new Noone(); // creates the textbox actor to show the image
    textbox.setImage(image); // gives image to textbox actor
}   
    /**
     * Act - do whatever the CompParts wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
     
 
public void act()
    {//opening act method
      if (getWorld() instanceof LivingRoom && // for the Here world
            textbox != null && // is there a textbox object to show
            Greenfoot.mouseMoved(null) && // did the mouse move
            mouseOn != Greenfoot.mouseMoved(this)) // is mouse changing between being on and off the actor
        {
            mouseOn = !mouseOn; // update saved state
            if (mouseOn) // hover beginning
            {
                getWorld().addObject(textbox, getX(), getY()-180); // show textbox
            }
            else // hover ending
            {
                getWorld().removeObject(textbox); // hide textbox
            }
        }
        if (getWorld() instanceof LetsBuild) // for the There world
        {
            if (Greenfoot.mousePressed(this)) // gets focus
            {
                // get location and world actor is in so it can be removed and added back in at the same place
                // (this is undocumented behavior to have dragged object painted over others in the world)
                int x = getX();
                int y = getY();
                World world = getWorld();
                world.removeObject(this);
                world.addObject(this, x, y);
            }
            if (Greenfoot.mouseDragged(this)) // is the actor being dragged
            {
                MouseInfo mouse = Greenfoot.getMouseInfo();
                setLocation(mouse.getX(), mouse.getY()); // keep actor with mouse
            }
        }
    }
//public void clickee()
{   
    //if (Greenfoot.mouseDragged(this))
        {//opening drag and drop
             
            //World world = getWorld();
            //MouseInfo mi = Greenfoot.getMouseInfo();
            //world.removeObject(this);
           // world.addObject(this, mi.getX(), mi.getY());
            //return;
             
 
        }//closing drag and drop
    }
 
 
}
the there are 7 actors under comparts, all with no code in them, they all have an image set not in the code, but was added when i added the class in. there is various other actors im using as info boxes to guide rather than images on the background like you did, but they are subclass of actor so dont interfear. i also made a Noone class which is your version of simple actor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import greenfoot.*;
 
/**
 * Write a description of class Noone here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class Noone extends Actor
{
    /**
     * Act - do whatever the Noone wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act()
    {
        // Add your action code here.
    }   
}
what did i break?
uncfan44 uncfan44

2016/4/27

#
i am required to use greenfoot 2.4.2 if that makes any difference, also upon further notice none of the parts move in the letsbuild world. i comment out my clickee method and nothing i had in the begining moves. the error is def somewhere in my comparts class as nothing in it appears to be working.
danpost danpost

2016/4/27

#
uncfan44 wrote...
what did i break?
I am guessing you have empty act methods in all the subclasses of CompParts which override the act method of the CompParts class. Remove the empty act methods from all the subclasses.
uncfan44 uncfan44

2016/4/27

#
didnt know the empty act method would over ride something in compparts, fixed it and everything works fine, just need to move and resize to clean up the looks! you are the man sir!
You need to login to post a reply.