ID:1781526
 
(See the best response by Mar big.)
For around 3 years I've had this peculiar football project. The code below shows that when you walk into a football, the icon of the football is at your feet and when you walk it moves with you (ultimately replicating what football players do when they dribble balls).

mob
Bump(A)
if(istype(A,/obj/balls/))
src.loc=A:loc
src.overlays+=A//so you see that player is dragging the ball with him
src.balldrag=new/obj/balls/ball1(src)
del(A)
return
else
..()
Move()
if(src.cantmove==1)
return
else
..()



How else can I do this? This seems rather impractical as it is difficult to remove the football icon from the mobs feet after the ball has been kicked.

Best response
Does the ball need to be on the map at all times? Could you possibly have a player take possession of the ball? You could add the ball to a player's contents, then remove it from their contents and add it to the map when they attempt to kick, or another player goes for a steal.

Edit
Your problem with removing the football icon is that you are adding the same overlay multiple times.
In response to Mar big
I'd assume it does need to be as other players may try to tackle said controller and dispossess them. Although what you said about it being in their contents does make sense.

I somewhat don't see where I'm adding the football overlay multiple times. Could you dictate that to me?
In response to Kboy33
If you bump into the ball multiple times it will add the overlay each time you bump into the ball. You could always add a check to see if you added the overlay already.
In response to Mar big
That's true. Other than that, to remove the overlay the procedure would just involve src.overlays-='ball.dmi' ?
In response to Kboy33
Yes, just make sure you don't add the overlay multiple times.
Kboy33 wrote:
I'd assume it does need to be as other players may try to tackle said controller and dispossess them. Although what you said about it being in their contents does make sense.

What you would do is add the logic of stealing and tackling to the player and make them lose control of the ball (adding it to the map) if someone successfully made them lose control or just add it directly to someone else's control if the they were to successfully steal the ball.