My cube

5/7/2025, 9:11:07 PM

  1. // ==UserScript==
  2. // @name My cube
  3. // @namespace Violentmonkey Scripts
  4. // @match https://johnbutlergames.com/games/opposite-day/1-2-1/index.html*
  5. // @grant none
  6. // @version 1.1
  7. // @author God NTSC Player
  8. // @description 5/7/2025, 9:11:07 PM
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. const imageURL = 'https://pbs.twimg.com/profile_images/1707398013398974464/lu87Drbo_400x400.jpg';
  15. let playerImage = new Image();
  16. playerImage.src = imageURL;
  17. playerImage.onload = function() {
  18. console.log('Player image loaded successfully');
  19. };
  20.  
  21. let lastDirection = 'right';
  22.  
  23. function overridePlayerDraw() {
  24. if (typeof player !== 'undefined' && typeof player.draw === 'function') {
  25. player.draw = function() {
  26. if (this.xmove > 0) {
  27. lastDirection = 'right';
  28. } else if (this.xmove < 0) {
  29. lastDirection = 'left';
  30. }
  31.  
  32. ctx.save();
  33.  
  34. if (lastDirection === 'left') {
  35. ctx.scale(-1, 1);
  36. ctx.drawImage(playerImage, -(this.x + this.w), this.y, this.w, this.h);
  37. } else {
  38. ctx.drawImage(playerImage, this.x, this.y, this.w, this.h);
  39. }
  40.  
  41. ctx.restore();
  42. };
  43. } else {
  44. setTimeout(overridePlayerDraw, 100);
  45. }
  46. }
  47.  
  48. overridePlayerDraw();
  49. })();