Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / radiating sprites

Author
Message
Jedi Padawan
17
Years of Service
User Offline
Joined: 17th Jun 2009
Location: None of your business
Posted: 17th Mar 2010 21:22
I am making a simulation program where a sprite (base) radiates 6 sprites (reporters) to capture a target sprite (target). When the reporters capture a target (collision), they should return back to the base, and a variable that detects detection should increment. I don't know how to go about doing this.

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Mar 2010 01:04
The simplest method is to rotate your sprite (or a hidden object) to the direction it needs to travel, then move it forwards. No need for any complex mathematics to position objects.

Jedi Padawan
17
Years of Service
User Offline
Joined: 17th Jun 2009
Location: None of your business
Posted: 18th Mar 2010 01:16
Let me make myself clear - I want various sprites to radiate from a sprite and then return from whatever position they are in.

P.S. both types' movement is random

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Mar 2010 19:16
I think I understand your concept.
You have all the information you need already, you just don't know it...
I will assume you are working 2-D.
First, make all your sprites. I would make 3: your "base", "target", and "collector". Use paste sprite to place the "collectors". (hide the original "collector" sprite)
Randomly move the "collectors" and the "target".
Do a loop for all your collectors, and within that loop position the original "collector" sprite (that you hid earlier) in the same location as each "collector" then do a sprite collision check between the hidden "collector" sprite and the "target" sprite. If they collide, then do whatever you want to do for collection and set a direct course for the "base".

I hope that helps.

The fastest code is the code never written.

Login to post a reply

Server time is: 2026-07-26 21:11:55
Your offset time is: 2026-07-26 21:11:55