"Pixel Perfect" Collision Version 2 - Platformer Game

good work man!

well you can ask @Jovanny

can i get the wick file or the code for lockable doors

1 Like

The person who made this is not active on the wick forums but he’s still active on youtube

ok then i didn’t know

well then ok

nvm he’s active here the last time he logged in was 2 days ago

ok ;) what is his yt

His YT is also called Revon wait let me get the link

ill just search revon

oh i didn’t find him

here is his channel: https://youtu.be/76-t6nD5TiE

did u get the link

ok thanks :)

hey @Revon or @Jovanny can you send some code and .wick files I need the moving platform code for sticking to it and @Jordy needs lockable doors

Moving platform code

It adds the platform’s speed to the player’s position (x coordinate) and its own position (x coordinate).

This is old code! And it is combined with “pixel perfect” functions for its collisions.

this.player_touch = false;
this.direction = 0;
this.SPEED = 5;
project.TILES.push(eval(this._identifier));

this.update_hitbox = function () {
    this.hitbox = project.get_tile_hitbox(eval(this._identifier));
};

this.update_hitbox();

onEvent('update', function () {
    if (this.x > 245 && this.direction === 0) {
        if (this.player_touch) {
            player.x -= this.SPEED * player.delta_time;
        }
        this.x -= this.SPEED * player.delta_time;
        this.update_hitbox();
    }
    else if (this.x < 465 && this.direction === 1) {
        if (this.player_touch) {
            player.x += this.SPEED * player.delta_time;
        }
        this.x += this.SPEED * player.delta_time;
        this.update_hitbox();
    }
    else {
        this.direction = ((this.direction === 0) ? 1 : 0);
    }
});
4 Likes
Lockable door

It checks if the “key” or moved block has reached the “key hole”. If it did, then open the door; else, lock it. For the locking part, it just disable the “teleportation”.

the “key hole”'s code:

onEvent('update', function () {
    if (this.hitTest(box1)) {
        door.locked = false;
    }
    else {
        door.locked = true;
    }
});

the door’s code:

this.locked = true;

onEvent('update', function () {
    if (this.locked === false) {
        if (this.hitTest(player)) {
            gotoNextFrame();
        }
    }
});
3 Likes

Welcome back!!!

1 Like

Thanks! I’m watching this forum, but I’m inactive for making games, proof of concepts, and stuff. School is the first priority! Even when I don’t want school. . .

4 Likes