Game
BossMan
7 years ago

BossMan Devlog 4: Basic Abstraction


You guys, I found a solution to that funky collision. You know the one, that thing where if you’re standing next to a wall and holding something and you happen to turn or move and the thing you were holding stays in place. Yeah, and it would just be stuck there, sort of rotating when you rotate, still acting as though it is held but maybe, like, across the room from the player by this point. It was almost the first thing anybody seemed to encounter when playing, a little “oh!” moment of broken suspension of disbelief. Well, you guys, I found a solution.

Move the player.

You see, the way I’m working with collisions, I have the objects themselves set to move away from the wall, much as the player does. However, when an object is being held by the player, it is told to move to a place a certain distance from the player into a position in which it might be held and carried. The basic setup uses the following code:

x = radiussin(degtorad(obj_player.image_angle+90)) + obj_player.x;
y = radiuscos(degtorad(obj_player.image_angle+90)) + obj_player.y;

where the radius is the distance of the center of the object being held from the center of the player.

Right. So that handy piece of code just sort of indelicately swings the object around, and the object invariably ends up getting stuck in the wall. When that combined with the code for the object to move away from the wall, the object would read where it was supposed to be, check what it should be doing, and go sliding across the room, moving down or up or across the screen as it has been told to when colliding with a wall, and as long as the player is holding the object in that wall, it’s detecting to that collision. The player, unlike the object, has not moved.

The answer is not to move the object upon colliding with the wall, but to move the thing holding the object until that collision ends. In this case, we’re talking about the player.

I had devised a whole system, a process whereby a special object would be made to mimic the salient aspects of a held item, and this object would pre-empt collisions and disallow certain moves by the player. I spent a long bike ride thinking it through. I even started to implement it, but I was tired. I decided it would be easier to just tell the player object from the collision event of a held object with the wall to behave as though the player object itself were hitting the wall. And wall-ah.

Now, when an object, like an A.C. Unit or, like, a torso or something is held by the player, and that object runs into a wall, the player is told to respond as though the player itself is hitting the wall. Essentially, this extends the player’s collision mask to include that of the held object, and the whole unit bounces away from the wall so the object never gets stuck. Give the latest version (0.6.56) a spin and compare it to a previous version to see what I mean.

Thanks, everybody!



0 comments

Loading...

Next up

So

i may or may not make an full art of some person or i may just leave this like that-

"Thanks guys for endless hours of fun." 👍

(My first fan art. Read the article, please.)

#sonic #mario #photoshop

🍒Did you like the game? A demo is available for free on Steam.

✌️ Thanks for playing IndieGameiacs!

⚙️ Free Demo: http://bit.ly/UniDuni

📺 Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Shadow The Hedgehog X pixel art

Just a Pico sprite

What you all think

I-Buki

Mio-Da!

Ibuki Mioda!

Strange Umbrella

Call it 'wrong turn'!🚫 The feeling of running into a house with only one exit🚪, and being doomed to die. #pixelart #pixelartist #pixelartwork #art #pixel #indiegame #IndieGameDev #indieartist

Levels' maps.