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

Finished work on the emotions of a new character for the tank universe

Hi everyone! I started to create some environment props for my new video game, here is a cozy house in the forest. I'm planning to switch from Unity to Unreal... Let's see what new challenges I have to face. Made in Blender and Substance Painter.

Horror WIP A track that will be featured in a future horror game soundtrack! Stay tuned!

Likes appreciated ✌️

#gamedev #composer #horrorgame #indiegame #IndieGameDev #soundtrack

Rockin the Guitar, an Axe like Guitar I made for my Uni project

Made my first ever animation.

Some Shadow boss fight gameplay 👾

We're knee deep in multiple large features and "game feel". Quick peek behind the scenes in this weeks Dev Blog: https://bit.ly/2QmmaQM

A sneak peek at the new OST, can you guess what this song will be used for? 🤔

I made a small jungle house.