Showing posts with label engine programming. Show all posts
Showing posts with label engine programming. Show all posts

Tuesday, May 28, 2019

Engine at 99%

Changes in the engine:
-Everything has a sound. doors, levers. Only the monsters no.
-environmental sounds. per map sounds that the engine plays.
-mob scripting, we can add new mobs
-bugs and bugs fixed here and there.

whats left:
-mob animations, mob sounds. few mob bug patch.

Yup. so i need animations. Thats a hard thing because we dont have active artists at the moment. I'm a beginner artist myself so maybe I try to do something.

Thursday, May 23, 2019

Secrets 1

2D box-box intersection:

So someone asked me to help, how a basic intersection looks like. The game uses boxes, so i posted my box-box intersection implementation. My post from derpibooru:

the 2d box collision is the following:

if box a maximum x smaller than box b minimum x
OR
if box a minimum x larger than box b maximum x
the boxes are away from each others, collision false;

if box a maximum y smaller than box b minimum y
OR
if box a minimum y larger than box b maximum y
the boxes are away from each others, collision false;

if we are here, we have only one case left, collision detected, because the minimum x or maximum x is between the minimum and maximum x and the minimum y or maximum y is between the minimum and maximum y

how this looks as code? (just quickly, i hope its correct xD)


class vec2
{
public:
float x;
float y;
};

class box
{
public:
vec2 pos;
vec2 vol;
};

bool interBoxes(box _a,box _b)
{
if( a.pos.x+a.vol.x<=b.pos.x-b.vol.x||a.pos.x-a.vol.x>=b.pos.x+b.vol.x )
return false;
if( a.pos.y+a.vol.y<=b.pos.y-b.vol.y||a.pos.y-a.vol.y>=b.pos.y+b.vol.y )
return false;

return true;
}