Discussion: Classes detect & move towards other Classes


This is what I’ve tried so far.
I’ve drawn a red Ball sprite with a long thin black line from the Balls center to the top of the screen
The Ball sprites been drawn (cropped) so the Ball is the center when the Ball rotates clockwise
The Ball is in (GUY) class
An octopus sprite is in (OCTO) class

4 (GUY) class sprites are at the screens top
4 (OCTO) class sprites at the screens bottom
When a (GUY) class sprite’s width is less than 14, DO: rotate 1 degrees clockwise
When (GUY) class sprite senses overlapping (OCTO) class sprite, DO affected (GUY) class member, set size, width to 14.

When (GUY) class sprite, size, width, greater than 13, DO: Affected (GUY) class member, move forwards 0.01

This is a vague description of what’s been coded so far
This makes a Guy class sprite move towards an OCTO class sprite when a Guy class sprite overlaps the OCTO class sprite. And this stops the affected (GUY) class member from rotating
More work on the code is needed.

(When i say Width, i mean compare the Affected GUY class members width to a sprite with a width of 13)

1 Like

@Suzzy-Grey - this interesing logic :+1:. We will wait for the final result, I think that this may help in creating some scenarios for the game.:+1:

1 Like