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

2018/3/2

Unknown Cause for Tree changing

1
2
3
danpost danpost

2018/3/2

#
If you do not mind, share it here on the site with the "provide source code" checkbox checked so that it can be inspected.
hosfeldli hosfeldli

2018/3/2

#
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Rock here. * * @author (your name) * @version (a version number or a date) */ public class Rock extends Actor { //amount of rock you have int rockCounter; private boolean mineDown; /** * Act - do whatever the Rock wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { rock(); } //adds to rock counter if touching tree and space is down public void rock() { if (mineDown != Greenfoot.isKeyDown("space")) { mineDown = !mineDown; if (mineDown && isTouching(Survivor.class)) { rockCounter++; getWorld().showText("Rock:" + rockCounter, 100, 100); } } } public Rock() { GreenfootImage myImage = getImage(); int myNewHeight = (int)myImage.getHeight()/30; int myNewWidth = (int)myImage.getWidth()/30; myImage.scale(myNewWidth, myNewHeight); } } here is the rock class that is a mirror that does basically the same thing
hosfeldli hosfeldli

2018/3/2

#
I don't understand how to "show source code"
hosfeldli hosfeldli

2018/3/2

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Rock here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Rock extends Actor
{
    //amount of rock you have
    int rockCounter;
    private boolean mineDown;
    /**
     * Act - do whatever the Rock wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
       rock();
    }    
    
    //adds to rock counter if touching tree and space is down
    
    public void rock()
    {
        if (mineDown != Greenfoot.isKeyDown("space"))
        {
            mineDown = !mineDown;
            if (mineDown && isTouching(Survivor.class))
            { 
                rockCounter++;
                getWorld().showText("Rock:" + rockCounter, 100, 100);
            }
        }
    }
    
    
    public Rock()
    {
       GreenfootImage myImage = getImage();
        int myNewHeight = (int)myImage.getHeight()/30; 
        int myNewWidth = (int)myImage.getWidth()/30;
        myImage.scale(myNewWidth, myNewHeight);  
    }
}
is this source code
danpost danpost

2018/3/2

#
hosfeldli wrote...
<< Code Omitted >> is this source code
Yes. That is how you display it here in the discussion thread However, I was talking about uploading the entire project using the 'Share' button; but, I guess you have yet to learn about it. The button should be at the upper-right corner of the greenfoot app frame. You will get a dialog box with several tabs. You want the one that says to "Publish to Greenfoot Gallery" or something like that. Fill whatever info you wish, check the appropriate checkbox and click share.
PeterMuller PeterMuller

2018/3/2

#
Greenfoot is trash , it always crash Your tweeter Peter
hosfeldli hosfeldli

2018/3/2

#
I exported it now what do I do
hosfeldli hosfeldli

2018/3/2

#
I think this is how I do it
Super_Hippo Super_Hippo

2018/3/2

#
You didn't upload it.
hosfeldli hosfeldli

2018/3/2

#
I don't understand ;(
hosfeldli hosfeldli

2018/3/2

#
How do I do it
danpost danpost

2018/3/2

#
You created a webpage which is saved on your system. That is not what I was asking you to do. I was asking you to publish (share) it on the Greenfoot Gallery.
Super_Hippo Super_Hippo

2018/3/2

#
Click on Export, use the first of the four options and publish it with source using the account info from your Greenfoot account.
danpost danpost

2018/3/2

#
hosfeldli wrote...
How do I do it
danpost wrote...
tabs. You want the one that says to "Publish to Greenfoot Gallery" or something like that. Fill whatever info you wish, check the appropriate checkbox and click share.
hosfeldli hosfeldli

2018/3/2

#
6th_GameProg
There are more replies on the next page.
1
2
3