Help with encapsulation on lecture 12.

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
jamir
Posts: 5
Joined: July 29th, 2017, 7:10 am

Help with encapsulation on lecture 12.

Post by jamir » August 8th, 2017, 5:46 am

Whenever I run the program it works but their is only one poo in the top left corner when there are supposed to be three on the screen. Every time I run it the poo goes back to that same place.

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: Help with encapsulation on lecture 12.

Post by Zedtho » August 8th, 2017, 8:36 am

Whenever I run the program it works but their is only one poo in the top left corner when there are supposed to be three on the screen.
Do your 3 Poos have different coordinates? It seems they've all defaulted to 0, 0. Maybe that's why it seems to only be one? I can't give you any more help as long as we can't see the source code, though.
(Either by github.com or by sending it through an attachment like Chili tells you to in one of the "Sticky" topics in the forum)
Every time I run it the poo goes back to that same place.
I have a feeling there might be something wrong with how you initialized the Poo objects. Are you constructing them in the constructor?

Anyways, it'd be nice if you could send the source code so that we could have a look at it.

jamir
Posts: 5
Joined: July 29th, 2017, 7:10 am

Re: Help with encapsulation on lecture 12.

Post by jamir » August 8th, 2017, 9:17 pm

here is my solution in a rar file. Thanks for any help.
Attachments
poogame with classes and encapulation, constructors, adding more poos to game.rar
(7.11 MiB) Downloaded 134 times

jamir
Posts: 5
Joined: July 29th, 2017, 7:10 am

Re: Help with encapsulation on lecture 12.

Post by jamir » August 9th, 2017, 3:08 am

never mind thanks @zadtho I figured it out. They were all equaling (0,0) for x and y. It was a simple expression mix up in my constructor.

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: Help with encapsulation on lecture 12.

Post by Zedtho » August 9th, 2017, 7:53 am

Thought I'd said that? :?:

Nonetheless good job on fixing that yourself!

Post Reply