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

2018/11/8

how to make ball match color with the brick it hit??(breakout scenario)

Toodumbtocode Toodumbtocode

2018/11/8

#
does anyone know a way to make the ball change into the color of the brick it hit??? thank you I made a getcolor method but i dont know what to put
danpost danpost

2018/11/8

#
Toodumbtocode wrote...
how to make ball match color with the brick it hit??(breakout scenario) does anyone know a way to make the ball change into the color of the brick it hit??? thank you I made a getcolor method but i dont know what to put
Where did you put the getColorr method (what class)? and where don''t you know what to put (in that method or elsewhere)? Also, you should probably include your entire Ball class code so we know how you are applying color to a ball. The getColor method (as far as what you have for it) should also be provided. In fact, maybe the entire Brick class should be provided so it can be verified that the color is passed correctly.
Toodumbtocode Toodumbtocode

2018/11/8

#
I don't have access to a computer right now (I'm typing this on my phone) so I can't post my code until tomorrow. But my getcolor method is in the brick class. I think the getcolor method is what's gonna make the ball change color and I don't know exactly what to put in the method itself
danpost danpost

2018/11/9

#
Toodumbtocode wrote...
I think the getcolor method is what's gonna make the ball change color and I don't know exactly what to put in the method itself
Doubt that seriously. It should return a Color object that is the color that particular brick is. Somewhere in the Ball class, it is called when touching a brick to get that brick's color so that a ball can change itself to that color.
You need to login to post a reply.