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

2022/5/10

I need help, to put a "Game over" screen or an animation that says game over in greenfoot

1
2
3
4
5
danpost danpost

2022/5/11

#
Roshan123 wrote...
Here it goes
public class GameOver
{
  GifImage gifImg = new GifImage("gameover.gif");
  public void act
  {
     setImage(gifImg.getCurrentImage());
  }
}
Line 1 should be:
public class GameOver extends Actor
with the following line at the top of the class:
import greenfoot.*;
As an alternative, line 1 could be written as:
public class GameOver extends greenfoot.Actor
MR.UWU MR.UWU

2022/5/11

#
OK thank you very much
Roshan123 Roshan123

2022/5/12

#
danpost wrote...
Line 1 should be:
public class GameOver extends Actor
Oh, sorry. I literally forgot to make it a subclass of Actor class
MR.UWU MR.UWU

2022/5/12

#
how do i create a start menu can someone help me
MR.UWU MR.UWU

2022/5/12

#
because I have one but it is damaged with the gameover screen
MR.UWU MR.UWU

2022/5/12

#
this is the start menu code import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Menu here. * * @author (your name) * @version (a version number or a date) */ public class Menu extends World { flecha flecha= new flecha(); private int opcion=0; /** * Constructor for objects of class Menu. * */ public Menu() { super(600, 400, 1); prepararMundo(); } private void prepararMundo() { addObject(new Play(),300,190); addObject(new Goout(),320,250); addObject(flecha,230,185); } public void act() { if (Greenfoot.isKeyDown("UP") && opcion!=0) {opcion++;} if (Greenfoot.isKeyDown("DOWN") && opcion!=1) {opcion--;} if (opcion>=2) opcion=0; if (opcion<0) opcion=1; flecha.setLocation(275,250 +(opcion*100)); if (Greenfoot.isKeyDown("SPACE") || Greenfoot.isKeyDown("ENTER")) { switch(opcion) { case 0: Greenfoot.setWorld(new MyWorld()); break; case 1: Greenfoot.stop(); break; } } } }
danpost danpost

2022/5/12

#
MR.UWU wrote...
because I have one but it is damaged with the gameover screen
What do you mean by "is damaged with the gameover screen"? Details please! Nothing seems totally wrong with the Menu class given here.
MR.UWU MR.UWU

2022/5/12

#
I mean the menu is what is wrong because when I collide with a rival it shows the game over screen fine but when I reset it in the game menu it appears together with the game over screen
Roshan123 Roshan123

2022/5/12

#
MR.UWU wrote...
I mean the menu is what is wrong because when I collide with a rival it shows the game over screen fine but when I reset it in the game menu it appears together with the game over screen
You might have used static keyword somewhere. Probably this might be the cause of it (just a guess, not sure though)
MR.UWU MR.UWU

2022/5/15

#
Can someone help me how to put an animation in greenfoot for my menu please tell me
Roshan123 Roshan123

2022/5/16

#
MR.UWU wrote...
Can someone help me how to put an animation in greenfoot for my menu please tell me
Before posting anything, please try to read as a third person. Would you please add some common points like, how the animation should look like and how it should work (for example, if the cursor is above the menu, it's complexion turns darker)
MR.UWU MR.UWU

2022/5/20

#
Hello, I'm creating a car game, and I wanted to make my road move, but not in the real way, that is, it shows that it is moving, if someone has a code to do it, send it to me.
MR.UWU MR.UWU

2022/5/20

#
What I have to say is that when I give it pley in my menu, it looks like the road moves slowly, and when some time goes by, it goes fast, it is the same as the rivals that I have since the rivals after passing twice in the world they increase the speed is what I want the road to do
MR.UWU MR.UWU

2022/5/21

#
Hola
danpost danpost

2022/5/25

#
One way is to add lines to the road. A center line whose dashes moves down would make the road appear to be moving downward (or passing under a vehicle, facing upward, that is stationary but appearing to move forward). To make it more realistic, you can save the image of one segment of the line and copy/scale in proportion to the y-coordinate value. The speed of the line can also be made to be in proportion to the y-coordinate value to give some depth to what is being viewed (this would most probably require the y-coordinate value be saved and used in more precise than pixel units).
There are more replies on the next page.
1
2
3
4
5