Collision of platforms?

Hello everybody. I'm trying to create a top-down level. I created platforms around the enemy and the player so that they do not overlap each other. But it only got worse. Now they are stuck in each other and do not move. Is there a way to fix this? Or is it better to just forget about this idea?The Beast Within Divine Comedy - 0001.png
 

Attachments

  • The Beast Within Divine Comedy - 0003.png
    The Beast Within Divine Comedy - 0003.png
    17 KB · Views: 2
  • The Beast Within Divine Comedy - 0006.png
    The Beast Within Divine Comedy - 0006.png
    16.6 KB · Views: 2
  • The Beast Within Divine Comedy - 0007.png
    The Beast Within Divine Comedy - 0007.png
    16.9 KB · Views: 2
Hello everybody. I'm trying to create a top-down level. I created platforms around the enemy and the player so that they do not overlap each other. But it only got worse. Now they are stuck in each other and do not move. Is there a way to fix this? Or is it better to just forget about this idea?View attachment 2387

bumping , because i saw this while experimenting with platform attributes, i am pretty sure there is script to fix this...
 
@ArgosBigbayev,

OpenBOR entities are able to pass through each other by design, so there's no really good way to do this natively. You'll need to employ some script.

There's a couple of ways you could code it depending on how complex you want to get. More complex solutions would of course be more stable and nicer looking, but require more effort on your part. If I wanted to do this quick and dirty, I would put a fast repeating 0 damage attack box and a body box around all of my vehicles. Then, I would use one of these events:
  • ondoattack - Fires when attacks hit, but before the engine does anything with them. Probably the best option because you wouldn't have to worry about any native attack routines getting in the way. See below for a video on how it works.
  • takedamage - Fires when entity takes damage (even if the damage is 0 or negative).
  • didhit - Fires when dishing out a hit.
Each one requires a slightly different approach, but the basic principal is the same. Get position of both cars, and then modify the position of one or both by a slight amount. It's just a matter of working math to decide which way they're shunted based on the direction and angle. For simplicity, I would work each axis separately so I'm not trying to figure out a bunch of angles. They're just pushed a given amount on the X axis, and then a given amount on Z (or Y) axis, and on screen you'll get an angled shunt.

Mix in some sound effects and whatever else to suit your game.

OpenBOR DoAttack Event:


HTH,
DC
 
Back
Top Bottom