My cube

2/17/2025, 12:40:37 PM

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        My cube
// @namespace   Violentmonkey Scripts
// @match       https://johnbutlergames.com/od2/index.html*
// @grant       none
// @version     1.0
// @author      God NTSC Player
// @description 2/17/2025, 12:40:37 PM
// ==/UserScript==

(function() {
    'use strict';

    const imageURL = 'https://pbs.twimg.com/profile_images/1707398013398974464/lu87Drbo_400x400.jpg';
    let playerImage = new Image();
    playerImage.src = imageURL;
    playerImage.onload = function() {
        console.log('Player image loaded successfully');
    };

    let lastDirection = 'right';

    function overridePlayerDraw() {
        if (typeof player !== 'undefined' && typeof player.draw === 'function') {
            player.draw = function() {
                if (this.xmove > 0) {
                    lastDirection = 'right';
                } else if (this.xmove < 0) {
                    lastDirection = 'left';
                }

                ctx.save();

                if (lastDirection === 'left') {
                    ctx.scale(-1, 1);
                    ctx.drawImage(playerImage, -(this.x + this.w), this.y, this.w, this.h);
                } else {
                    ctx.drawImage(playerImage, this.x, this.y, this.w, this.h);
                }

                ctx.restore();
            };
        } else {
            setTimeout(overridePlayerDraw, 100);
        }
    }

    overridePlayerDraw();
})();