I need help again

im making game how do you add blocks

and here is file My Project11-20-2080_19-17-33.wick

hi meow and hi again

Make a block, and copy paste this to the update script:

Update Script
var ukn=player.speed*-2;
var ukgn=player.gravity*-3;
if(this.hitTest(player)){
if(player.x>this.x+(((this.width/2)+(player.width/2))-ukn)&&player.speed<0){
player.x=this.x+((this.width/2)+(player.width/2));
player.speed=1;}
if(player.x<this.x-(((this.width/2)+(player.width/2))+ukn)&&player.speed>0){
player.x=this.x-(((this.width/2)+(player.width/2))-0.1);
player.speed=-1;}
if(player.y>this.y+(((this.height/2)+(player.height/2)+ukgn))){
player.gravity=-10;
player.y=this.y+((this.height/2)+(player.height/2)+1);
}
if(player.y<this.y-(((this.height/2)+(player.height/2))-ukgn)){
player.y=this.y-(((this.height/2)+(player.height/2))-1);
if(isKeyDown('up')||isKeyDown('w')){
player.gravity=150;}else{player.gravity=0;
}}}
// Not the best collision for a block

The code is something I use for my own collisions and based on your file’s player, so it should work perfectly, otherwise let me know.

Here’s a file as an example: (2.9 KB)

Also, I’m not the best at creating great perfect collisions (Baron, pumpkinhead, and Revon are) so I would recommend taking a look at one of the following platformers:

Baron
pumpkinhead
Revon
2 Likes