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

2018/1/13

Help me with the creation of my game called 'aa'

1
2
3
frequency frequency

2018/1/13

#
Hello guys. I want to make a game like that on greenfoot. This is my code : My world:
public MyWorld()
    {       
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(1920, 1080, 1); 
        setBackground(new GreenfootImage("gri.jpg"));
        addObject(new Circle1(),600,400);
        
        
        
}
CircleBody (empty) Cirlce1 (empty) BackgroundLevel1(empty) Level1(empty) Now,i cant sync the diameters of the world and the background so they can fit. This is my level 1 image https://imgur.com/a/LqZDB . I cant make it fit to the world.Either the world is too small or too big or i resize the image too low or too high.ARGHH. For now i just want to do this. Align the image! Thanks
Super_Hippo Super_Hippo

2018/1/13

#
Maybe this gives you a start on how to create an image as you want.
GreenfootImage bg = new GreenfootImage(getWidth(), getHeight());
bg.setColor(Color.WHITE);
bg.fill();
bg.setColor(Color.BLACK);
bg.fillOval(getWidth()-50, getHeight()-50, 100, 100);
setBackground(bg);
frequency frequency

2018/1/14

#
Should i paste that in world? or in the actor?
danpost danpost

2018/1/14

#
You should probably explain in more detail what you mean by "cant cync the diameters...so they can fit." Also, give what dimensions you are working with and show what code you have tried. Explain exactly how it is wrong and what it should be correct to do.
frequency frequency

2018/1/15

#
i want the background picture to have the same pixels as the world.I just cant find the perfect fit
danpost danpost

2018/1/15

#
Try:
GreenfootImage bg = new GreenfootImage("gri.jpg");
bg.scale(getWidth(), getHeight());
setBackground(bg);
frequency frequency

2018/1/17

#
Thanks,i remade an image and everything is good! Now i want to make the "little black balls(( ͡ ° ͜ʖ ͡ ° ))" move up and create a line when they go above! For example look here at the bottom when the balls go up!
danpost danpost

2018/1/17

#
frequency wrote...
i want to make the "little black balls(( ͡ ° ͜ʖ ͡ ° ))" move up and create a line when they go above!
Then you need a trigger (and a field to track state of ball -- not triggered, triggered and hub connected) to set the ball moving and you will need another Actor subclass for the connecting line. Each line can be assigned to the hub when a ball is properly placed and each line can reference which ball it is connecting the hub to. As such, the hub can control all balls and lines rotating around it.
frequency frequency

2018/1/18

#
Can you help me with the code a bit? For example,lets name the black ball (ball1) and the arrow (arrow1).SO,i should technically write greenfoot to place a BALL1 in X,Y of the map,and if a certain key is pressed down, and BALL1 is not touching an other ball,BALL1 move X,Y above and place an arrow1 on the ball1 or something. Any thoughts and code ? Thank you~!
danpost danpost

2018/1/18

#
If the image used for the arrows was half transparent, then all you would need do to them is have them rotate and, by overriding the 'setRotation' method, move the balls they are attached to. See what you can come up with for the arrows and, if when stuck, post it for help.
frequency frequency

2018/1/22

#
I made an arrow and an actor. I can not get my head think how can i put those together when the main body of the ball spinning. So lets make a plan.First of all lets make the easy ones first. 1. Make the main ball spin(centered ball (circle1.class)) 2. Make the small ball go only up. I tried the move string but it kept moving and at the wrong direction.I want to make it to UP,ONCE and get attached to the circle while spinning. 3.When shooting the mini balls,launch a arrow attaching to the mini balls,unite together,and get placed on the ball while spinning. But i AM SO STUCK :/
danpost danpost

2018/1/22

#
frequency wrote...
1. Make the main ball spin(centered ball (circle1.class)) 2. Make the small ball go only up. I tried the move string but it kept moving and at the wrong direction.I want to make it to UP,ONCE and get attached to the circle while spinning. 3.When shooting the mini balls,launch a arrow attaching to the mini balls,unite together,and get placed on the ball while spinning.
(1) does a spinning circle even appear to spin? that is, does it really need to spin at all? I think not (unless it is textured or has a design on it). (2) only when below a particular y-coordinate value will a mini-ball be triggered to move up; if below that limit, only when no ball is some set distance above it; when above the limit, its movement should be controlled by the arrow that binds it to the main ball. (3) if triggered (user hits a key or taps mousepad or whatever), the mini-ball jumps up and attaches itself by a new arrow to the main ball; the triggering should only be allowed on a mini-ball at the limiting y-coordinate value. The main ball should control all arrows to rotate around it. If arrows are placed at the same location as the main ball, all it would need to do is to rotate them. This would require one half the image of the arrow to be transparent and the other half with the arrow image drawn on it. The arrows, in turn, should move its mini-ball along at its arrow image end.
frequency frequency

2018/1/24

#
Hello, I managed to get the Main ball to spin around its self with
turn(10)
.I also placed a ball underneath the Main spinning ball. The task is to make the program Place a ARROW on top of the mini ball and connect each other.Both the miniball with the arrow. And those 2 united to the ball spinning. And those should be spinning with the ball as well.Since they are attached to it.I got no idea how to do this for now. And i have to complete it until next week!
frequency frequency

2018/1/24

#
I also made the mini ball go up with
 void move()
    
    {  
    if (Greenfoot.isKeyDown("SPACE"))
    {
           setLocation(getX(), getY() - 4);

    }
    
This keeps going for ever upwards.I want this to go one time and at a specific location.X,Y
danpost danpost

2018/1/24

#
Use something like this:
if (getY() == 400 && Greenfoot.isKeyDown("space"))
The '400' should be whatever y-coordinate the mini-ball has when triggered to the main ball. The main ball can use 'getIntersectingObjects(Arrow.class)' to get arrows it will turn with itself. The arrows can then move its own mini-ball when it is moved.
There are more replies on the next page.
1
2
3