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

2020/4/19

I need help

1
2
3
danpost danpost

2020/4/19

#
MikaR03 wrote...
How do you mean i dont see where the crash method is called from what do i have to do whit that method. I just called it "crash" or cant i do that?
You can name it pretty much anything you want; but you must call it to have its code executed. That is, somewhere outside the method, in some already executing code (like the act method -- when the actor of the class is in the active world), the method must be called upon to execute as with:
crash();
MikaR03 MikaR03

2020/4/19

#
thankyou, but now i have the problem that it already goes to game over even the cars didnt even touch
danpost danpost

2020/4/19

#
MikaR03 wrote...
thankyou, but now i have the problem that it already goes to game over even the cars didnt even touch
Please show the Tegenliggers class codes.
MikaR03 MikaR03

2020/4/19

#
import greenfoot.*;

/**
 * Write a description of class Tegenliggers here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Tegenliggers extends Actor
{
    /**
     * Act - do whatever the Tegenliggers wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void checkRand() 
    {
       
   
    {
        if (getY()<-10)
        {
            getWorld().removeObject(this);
    }    
   }
   } 
   

}
MikaR03 MikaR03

2020/4/19

#
Thats the tegenliggers class code
danpost danpost

2020/4/19

#
MikaR03 wrote...
Thats the tegenliggers class code
Ah, that is where checkRand is. It seems okay. I do not see why it would immediately go to game over. Will review again a little more closely.
danpost danpost

2020/4/19

#
Perform the following test and report results: Comment out lines 20 thru 25 in the Brandweer1 class (as shown at the bottom of page 1 of this discussion). Run and determine any change in behavior. That is -- does it still go to game over as before? Uncomment when testing is complete.
MikaR03 MikaR03

2020/4/19

#
What do i have to do? Just delete the lines? I dont understand you sorry.
MikaR03 MikaR03

2020/4/19

#
What do i have to do with this? {     if(isTouching(CAR.class))     {       removeTouching(CAR.class);      Greenfoot.setWorld(new GameOver());     }
danpost danpost

2020/4/19

#
MikaR03 wrote...
What do i have to do? Just delete the lines? I dont understand you sorry.
Select (highlight) the lines and press F8. (F7 to uncomment)
MikaR03 MikaR03

2020/4/19

#
if i highlight it and than press f8 it just doesnt do anything when the cars hit eachother
danpost danpost

2020/4/19

#
MikaR03 wrote...
if i highlight it and than press f8 it just doesnt do anything when the cars hit eachother
Okay, then for some reason, the enemy cars are either not all being spawned at (150, 0) or they are being instantly moved to the bottom of the screen.
Super_Hippo Super_Hippo

2020/4/19

#
What are the dimensions of the images?
MikaR03 MikaR03

2020/4/20

#
Oh, I got it I made my background transparent of the car so it was a very big image. Thank you very much. .
MikaR03 MikaR03

2020/4/20

#
I wave just one question. I want to put in background music. In which class do I have to put it in and what is the code for it? I have no clue.
There are more replies on the next page.
1
2
3