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

Report as inappropriate.

danpost
danpost presents ...

2019/1/21

Smooth Mover Demo

This demo exhibits the differences between standard movement and two different smooth mover classes.

Three sub-worlds were created, one for each helper class. The 3 classes are:

Non-helper: a class with no code to assist in movement;
SmoothMover: provided with greenfoot to assist actors in moving more accurately;
QActor: provided by me to assist actor in moving and turning more accurately;

All worlds have 6000 balls move toward a stationary ball to bounce off it. About 5400 balls actually bounce in each instance. All balls attempt to approach the still one at different y-coordinate values, all different by 1/100th of the size of one pixel. The important thing to look at are what reflected angles are taken. A trail is left by all balls after bouncing for inspection.

CONTROLS:
KEYS: 1-5 to change ball speed
MOUSE: on drop-down menu to change helper class

Source is given so that any questions about "fudging" (intentional) can be dismissed.

4928 views / 17 in the last 7 days

4 votes | 0 in the last 7 days

Tags: demo with-source smoothmover danpost qactor smoothmoving

This scenario is a member of: Demos by danpost


open in greenfoot
Your browser is ignoring the <APPLET> tag.
A new version of this scenario was uploaded on 2019-01-21 21:21:27 UTC
A new version of this scenario was uploaded on 2019-01-21 21:23:58 UTC
momochowmomochow

2019/1/23

hi @danpost I'd like to ask for your help with my personal project which should be really easy for you. It's a board game that I'm trying to make on greenfoot. It'd be great if you could help me. I may be able to contribute to your paypal account as well.
444Jam444444Jam444

2019/12/1

I was going to ask the y-coord of the stationary ball but it's fine. I looked at the code. For those interested: Stationary ball is at 300y (and 200x) with a radius of 15px (30px diameter) Good work by the way danpost, very helpful. Was unsure of adding the SmoothMover class to my project. Now I'm convinced. Thanks. Also, don't mean to nit-pick, but line 5 of MyWorld has a typo in the comment. Not a big deal, but I thought I'd point it out.

Want to leave a comment? You must first log in.

Who likes this?

Riovanni Super_Hippo Notimeforoxygen data17