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/24

#
So you suggest that i add into my MINIBALL code the following INCLUDES THE OLD ONE
void move()
    
    {  
    if (getY() == 400 && Greenfoot.isKeyDown("SPACE"))
    {
           setLocation(getX(), getY() - 4);





    }
Now i cant move. Also what do you mean when
danpost wrote...
The '400' should be whatever y-coordinate the mini-ball has when triggered to the main ball.
Thanks!
danpost danpost

2018/1/24

#
"SPACE" should be "space" (lowercase).
frequency frequency

2018/1/24

#
Still no movement!
Vercility Vercility

2018/1/24

#
frequency wrote...
Also what do you mean when
danpost wrote...
The '400' should be whatever y-coordinate the mini-ball has when triggered to the main ball.
Thanks!
You should replace the '400' in this code by said value.
frequency frequency

2018/1/24

#
Still!
frequency frequency

2018/1/24

#
Here,take a look http://www.greenfoot.org/scenarios/20710
Vercility Vercility

2018/1/24

#
Still because your value is incorrect. I dont know whats even supposed to happen but if you remove the gety ... its moving.
frequency frequency

2018/1/24

#
I feel so stupid atm.Which of the following should i remove? https://prnt.sc/i547u4
Vercility Vercility

2018/1/24

#
getY() == 4 && If you remove that your lower ball starts moving upwards, but i have no hell why the hell it was there in the first place or what its supposed to do so i cant tell you what to do else.
frequency frequency

2018/1/24

#
Do you get the point of the project?
frequency frequency

2018/1/24

#
Dan,how would you code it? See you tomorrow.GN<3
danpost danpost

2018/1/24

#
frequency wrote...
Dan,how would you code it?
If you used:
if (getY() == 550 && Greenfoot.isKeyDown("space"))
in the dot1 class, you will find the dot will jump, however a short distance. The '550' is the y-coordinate that the dot was placed into the world at. I do not know why you would look for intersecing arrows in the class of the arrow. All an arrow should do is maintain the dot assigned to it.
danpost danpost

2018/1/25

#
You will probably need a boolean field to track the state of the "space" key to prevent rapid firing. This field will need to have more scope than for a single dot object; so, in the dot class as a static field will probably work (so all dots refer to the same field).
frequency frequency

2018/1/25

#
Thanks for the reply, I have no clue how to do this. The only option is to guide me,send me some lines of code and thats how i will get it.I dont understand this atm. :/. So i delete the intersecting arrows from the class arrow:?
danpost danpost

2018/1/25

#
The Arrow class should just be the following (for now):
import greenfoot.*;

public class Arrow extends Actor
{
}
Before anything, however, you need a better image for the arrows. The image will need to be around 400 long with one side (longways) being transparent. Once you have that, you will be able to test any code you add or change. I would consider starting with the Circle first. All it needs to do is rotate and set the rotation of all its intersecting arrows to its new rotation. Then, you can move on to the Arrow class, which only needs to maintain its assigned Dot. The Dot class is the most complex and should be done last so that any texting on its progress is done with working Arrow and Circle classes.
There are more replies on the next page.
1
2
3