Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+9 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 (1 point)

5 Answers

+4 votes

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

answered by (1 point)
+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 (1 point)
+3 votes

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

answered by (1 point)
+2 votes

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

answered by (1 point)
0 votes

Yeah that's correct. You need to move the whole body at the same time and speed.

answered by (1 point)
...