Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var updooter = null;
- Game.registerMod('updooter', {
- init: function() {
- if (typeof CrumbsEngineLoaded === 'undefined' || !CrumbsEngineLoaded) { Game.LoadMod('https://raw.githack.com/CursedSliver/Crumbs-engine/main/Crumbs.js'); }
- const checkPrerequisites = function(self) {
- if (typeof CrumbsEngineLoaded !== 'undefined' && CrumbsEngineLoaded) { self.header(); clearInterval(interval); }
- }
- const interval = setInterval(checkPrerequisites, 10, this);
- updooter = this;
- },
- header: function() {
- Game.Notify('Updoot mod loaded!', '', [26, 7]);
- const bigCookieFragmentBehavior = new Crumbs.behaviorInstance(function() {
- for (let i in this.children) {
- if (this.children[i].ownComponent.hovered) { this.hovered = true; return; }
- }
- this.hovered = false;
- });
- let stuff = {
- imgs: 'https://rawcdn.githack.com/CursedSliver/asdoindwalk/031b0de87d0faec46b9c7d30f8f90721fd536057/perfectlyBrokenCookie.png',
- width: 512,
- height: 512,
- order: -1,
- id: 'frag',
- sx: 0,
- hovered: false,
- behaviors: bigCookieFragmentBehavior
- };
- this.display = Crumbs.findObject('bigCookie').findChild('bigCookieDisplay');
- this.display.noDraw = true;
- this.display.hovered = true;
- this.bigCookieMain = Crumbs.findObject('bigCookie');
- this.bigCookieMain.width = 256;
- this.bigCookieMain.height = 256;
- this.display.addBehavior(new Crumbs.behaviorInstance(function() {
- for (let i in this.children) {
- if (this.children[i].id != 'frag' || !this.children[i].enabled) { continue; }
- if (this.children[i].hovered) { this.hovered = true; return; }
- }
- this.hovered = false;
- }));
- this.bigCookieMain.addComponent(new Crumbs.component.pointerInteractive({
- onRelease: function() { if (updooter.display.hovered) { Game.ClickCookie(); } },
- boundingType: 'oval'
- }));
- this.bigCookieMain.addBehavior(new Crumbs.behaviorInstance(function() {
- if (!updooter.display.hovered) { Game.bigCookieState = 0; return; }
- if (this.getComponent('pointerInteractive').click) { Game.BigCookieState = 1; }
- else if (this.getComponent('pointerInteractive').hovered) { Game.BigCookieState = 2; }
- else { Game.BigCookieState = 0; }
- }));
- let fragmentHitBoxMap = {
- 0: [{x: 0, y: 0, r: 0, w: 512, h: 512 }],
- 1: [],
- 2: [],
- 3: [],
- 4: [],
- 5: [],
- 6: [],
- 7: [],
- 8: []
- }
- for (let i = 0; i < 9; i++) {
- stuff.sx = i * 512;
- stuff.order = -1 + i * 0.001;
- const child = this.display.spawnChild(stuff);
- for (let ii in fragmentHitBoxMap[i]) {
- const childChild = child.spawnChild({
- x: fragmentHitBoxMap[i][ii].x,
- y: fragmentHitBoxMap[i][ii].y,
- rotation: fragmentHitBoxMap[i][ii].r,
- width: fragmentHitBoxMap[i][ii].w,
- height: fragmentHitBoxMap[i][ii].h,
- components: new Crumbs.component.pointerInteractive({ boundingType: fragmentHitBoxMap[i][ii].type??'rect', alwaysInteractable: true, onClick: function() { console.log('true'); } }),
- behaviors: function() { if (this.getComponent('pointerInteractive').hovered) { console.log('yes!!!'); } }
- });
- childChild.ownComponent = childChild.getComponent('pointerInteractive');
- }
- }
- l('bigCookie').remove();
- var bigCookie = document.createElement('button');
- bigCookie.id = 'bigCookie';
- l('cookieAnchor').appendChild(bigCookie);
- },
- bigCookieMain: null,
- display: null,
- save: function() {
- },
- load: function() {
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment