One of the game objects will be an apple. Create an Apple class and make it inherit the GameObject class. To represent an apple on the playing field, you could paint cells containing apples any particular color. Or you could draw some apple-looking symbol in the cell. Let the Apple class store thi
Snake (Part 4/20)
You must be signed in to leave a comment
24 September 2020, 10:34
I keep failing to pass the following requirement. Can anyone give me some guidance? "The draw(Game) method must call the setCellValueEx(int, int, Color, String, Color, int) method on a Game object with the following arguments: x, y, Color.NONE, APPLE_SIGN, <color of the apple>, 75. (Replace <color of the apple> with a color you like, for example, Color.GREEN)."
25 September 2020, 09:47
Please post your question with the attached solution in the section Help.
19 September 2020, 20:56
can someone explain to me why apple.draw(this) works? I mean I get that apple.draw(apple) is wrong since apple is of type Apple while draw(Game) expects Game type but why does "this" work? I thought "this" refers to the object that's calling the method which is apple so "this" should be of type Apple too?
13 July 2021, 13:46
The same question for me...😬
5 March 2022, 03:52
Hi! No, the 'this' keyword refers to the class.
22 April 2022, 16:36
@Tara this is the first time i see that "this" refers to a class . I used to know that it refers always only to the current object
14 September 2022, 15:43
"this" refers to the object of SnakeGame class, because SnakeGame inherit Game class，so "this" can also call the setCellValueEx() method.
13 March 2020, 12:49
Which Project Language Level must be choosen in IntelliJ Idea or which SDK ?
16 March 2020, 07:00
21 July 2019, 04:53
Hi team, We are unable to meet the below requirement. Could you please elaborate about the same. The draw(Game) method must be called on the created apple. Pass this to the method.
14 June 2021, 13:46
it can be a little confusing, the right sentence i think will be: Pass 'this' to the method.