Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+6 votes

A fish contains a lot of graphics, when we write a code to move a fish, do we have to include the tails, the body,... to move the entire fish? Is there any other ways to group the objects to move the whole fish at the same time? Thank you

asked in CSC201 Spring 2021 by (4.1k points)

4 Answers

+4 votes

If you want to move the fish, you should move the body, the tail and the eye.

answered by (4.3k points)
+4 votes

The move method in class Fish should contain all the move functions of the tail, the body, and the eye. Therefore, when you call the move method in main, the entire parts of the fish will move at the same time.

It isn't necessary but you can create a list of objects to group them all and using the for loop to move each object at the same time (just like what we will do in setupFish() and setupBubble())

answered by (2.8k points)
+3 votes

Yes I think Ngoc is right. You need to move every part of the fish at the same speed.

answered by (4.1k points)
+2 votes

I also agree with what Ngoc and Thu said, you are supposed to move every body parts of the fish.

answered by (3.6k points)
...