"Pixel Perfect" Collision Version 2 - Platformer Game

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

I thought you were never going to reply

I’m not here that often. I’m here at least once a week.

can you send me a wick file for the the moving platform?

It’s in the play & download link
Wick Editor platformer PoC by Revon Zev.wick (22.8 KB)