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

2018/2/12

Helper Classes

okwuvic okwuvic

2018/2/12

#
Please where can I get the helper classes
danpost danpost

2018/2/12

#
okwuvic wrote...
Please where can I get the helper classes
Helper classes are included in the greenfoot download. In the menu bar, just select 'Edit>Import class...' and select among those listed in the dialog.
okwuvic okwuvic

2018/2/12

#
Thanks so much. I was actually looking for Mover Class. But I found in the direction you gave me is SmoothMover. Are they the same?
danpost danpost

2018/2/12

#
okwuvic wrote...
I was actually looking for Mover Class. But I found in the direction you gave me is SmoothMover. Are they the same?
Not quite. The SmoothMover class gives the actor apparent movement that is not limited by the hardware (you cannot move between pixels; but if you track location coordinates more precisely, you can gain more control of the location of the actor). I do not think greenfoot has a Mover class in itself, but it does also come with an Animal class which has a speed field and a 'move' method. What would be best, in your case, depends on what functionality you are looking for in your actor. If interested in ideas, ask with details.
okwuvic okwuvic

2018/2/13

#
Thanks so much for your effort danpost. I watched this video on youtube and the tutor actually went to a greenfoot website to copy a Mover Class and pasted on his scenario but I cannot find that particular url. Please watch the video: https://www.youtube.com/watch?v=w7qSSPIKdFU and advice me.
danpost danpost

2018/2/13

#
Okay, the video had shown me the class documentation. It consists of 5 methods -- 2 of which are now included in the Actor class ('atWorldEdge()' and 'turn(int)'). The other 'turn()' method is just the same as 'turn(90)'. The last two methods are 'move()' and 'move(double)' where the first just calls the second using the 'double WALKING_SPEED' field. Since the coordinate location of the actor is not stored as double values, it does not effectively give the actor smooth movement. Also, if you had not noticed, the video was uploaded 6+ years ago -- using one of the earlier versions of greenfoot (probably greenfoot v2.0.1). So, in my opinion, with what is given above, you are probably better not to use the class at all. Like I stated before:
danpost wrote...
What would be best, in your case, depends on what functionality you are looking for in your actor. If interested in ideas, ask with details.
okwuvic okwuvic

2018/2/14

#
Thanks so much @danpost. I understand now. God bless you.
You need to login to post a reply.