JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://cdn.crafty-modules.com/crafty-DEBUG.js"></script>
<script src="https://raw.github.com/BlackScorp/crafty_hitbox/master/hitbox.js"></script>

JavaScript

Crafty.init();
Crafty.canvas.init();

Crafty.sprite(256,288,"http://files.cruel-online.de/img/objects/smithy01.png",{house:[0,0]});
Crafty.c("Building",{
    ground:[],
    init:function(){
                                                                                 
        this.requires("house,Collision,WiredHitBox").collision(new Crafty.polygon(this.getGround()))
            
        
    },
    getGround:function(){
      var gk = this.w/2;
var alpha = 30;
var rad_a = alpha * Math.PI / 180; //Math braucht radian
var hyp = gk / Math.cos(rad_a);
var ak = ~~Math.sqrt(Math.pow(hyp,2) - Math.pow(gk,2));
        var k = this.h - ak;
      
       return[[this.w/2,this.h],[0,k],[this.w/2,this.h-ak*2],[this.w,k]];
    }
});

var building = Crafty.e("2D,DOM,Building");

/*
var gk = 256/2;
var alpha = 30;
var rad_a = alpha * Math.PI / 180; //Math braucht radian
var hyp = gk / Math.cos(rad_a);
var ak = ~~Math.sqrt(Math.pow(hyp,2) - Math.pow(gk,2));
console.log("Hypotenuse = " + hyp);
console.log("Ankathete = " + ak);

*/