Skip to main content
GameDev.net gamedev.net
🔒 Locked

MouseOver'd array

Started by PerksPlusPlus Feb 24, 2009 at 3:42 PM 0 replies 450+ views
Original Post
PerksPlusPlus
PerksPlusPlus
So I'm working on a RTS movement system, where the goal is I select a group of units. click/hold a key, drag my mouse, and then move my units to random points allong where I draged my mouse. BUT the user could move the mouse more than its size in a single update and I'd end up with my units scattering something like this -- ------ -. I'm using allegro,I think the fix would be something like drawing a line between each mouse location and getting all the points between each location. the problem would be I'm not sure how to go about doing that Oo.
Zahlman
Zahlman
Quote:
Original post by PerksPlusPlus
BUT the user could move the mouse more than its size in a single update and I'd end up with my units scattering something like this -- ------ -.


1) "its size"? What size?
2) Do you want the user to be able to draw any kind of path, or will you just take the beginning and ending of the drag and put units along a straight line between them? In either case you will probably want to wait until the user releases the mouse before doing anything.
3) If the whole point is that the units are moved to random points along the path, then why does it matter if there is clumping?

In any case, you might want to look up the Bresenham line algorithm.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.