ScratchData LogoScratchData
Back to ecker00's profile

Prey & Predator, Boids Flocking AI

ECecker00•Created February 8, 2014
Prey & Predator, Boids Flocking AI
16
13
828 views
View on Scratch

Instructions

Use Turbo Mode! (Shift click green flag) Click the green flag twice. Mouse: Chase the agents around. Arrow Up: Add agents Arrow Down: Remove agents Space: Toggle trails effect. Q: Increase max range (range which the agents attract each other) A: Decrease max range W: Increase min range (range which the agents stop attracting) S: Decrease min range E: Increase agent speed D: Decrease agent speed R: Increase number of frames to skip before recalculating. F: Decrease number of frames to skip before recalculating. What is boids? http://en.wikipedia.org/wiki/Boids The agents will flock together, once they are close to each other, the flock will circulate the scene slowly. Same happens if no other agents are in close proximity. Note: The agent script is exponentially more processing heavy for every agent added to the scene. As every agent checks the distance to all other agents, and act appropriately based on that. Increase the "ReCalc Skip" value to improve performance, but suffer how accurate the agents flock together.

Description

Ideas: - Adjustable distance they avoid the mouse pointer. - Adjustable acceleration (speed at which they change direction). - Gameplay: High score based, catch them as fast as possible. - Gameplay: Catch them all within the time limit. (Multiple levels?) - Click to "explode" and kill all agents in a radius around the mouse. Change Log (12 Feb 2014): - Adjustable min range. - Adjustable max range. - Adjustable speed. - Adjustable number of agents. - Adjust how often the agents recalculate target position. - FPS counter.

Project Details

Project ID17686394
CreatedFebruary 8, 2014
Last ModifiedOctober 19, 2014
SharedFebruary 10, 2014
Visibilityvisible
CommentsAllowed