Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --40 pixels
- --26, 66, 106
- --"Graphics.loadImage(Misc.resolveFile(filename))" -Enjl, the wise one
- local debugModeOn = true;
- local camera = Camera.get()[1]
- local freeCamEnabled = false;
- local pressedTanooki = false;
- local freeCameraX = 0;
- local freeCameraY = 0;
- local pose = 0;
- local previousPowerup = 0;
- local allowedCharacters = {[CHARACTER_MARIO] = true, [CHARACTER_LUIGI] = true, [CHARACTER_TOAD] = true};
- local hudEnabled = false;
- local ui_box1 = Graphics.loadImage(Misc.resolveFile("ui_box1.png"));
- local box1_position = {x = 372, y = 16};
- local box1_item = 0;
- local ui_hearts_backdrop = Graphics.loadImage(Misc.resolveFile("ui_hearts_backdrop.png"));
- local ui_heart = Graphics.loadImage(Misc.resolveFile("ui_heart.png"));
- local ui_heart_empty = Graphics.loadImage(Misc.resolveFile("ui_heart_empty.png"));
- local hearts_position = {x = 372, y = 28};
- local hearts = player:mem(0x16, FIELD_WORD);
- local ui_score = Graphics.loadImage(Misc.resolveFile("ui_stars.png"));
- local stars_position = {x = 50, y = 28};
- local score = mem(0x00B2C8E4, FIELD_DWORD);
- local stars = mem(0x00B251E0, FIELD_WORD);
- local ui_life = Graphics.loadImage(Misc.resolveFile("ui_1up.png"));
- local life_position = {x = 470, y = 28};
- local lives = mem(0x00B2C5AC, FIELD_FLOAT);
- local textOffset = {x = 44, y = 10};
- local ui_coins = Graphics.loadImage(Misc.resolveFile("ui_coin.png"));
- local coins_position = {x = 620, y = 28}
- local normalCoins = mem(0x00B2C5A8, FIELD_WORD);
- local stargate_star1 = Graphics.loadImage(Misc.resolveFile("stargate_star1.png"));
- local stargate_star2 = Graphics.loadImage(Misc.resolveFile("stargate_star2.png"));
- local stargate_star3 = Graphics.loadImage(Misc.resolveFile("stargate_star3.png"));
- local stargate_star4 = Graphics.loadImage(Misc.resolveFile("stargate_star4.png"));
- local stargate_star5 = Graphics.loadImage(Misc.resolveFile("stargate_star5.png"));
- local stargate_star6 = Graphics.loadImage(Misc.resolveFile("stargate_star6.png"));
- local stargate_star7 = Graphics.loadImage(Misc.resolveFile("stargate_star7.png"));
- local stargate_star8 = Graphics.loadImage(Misc.resolveFile("stargate_star8.png"));
- local flash1 = Graphics.loadImage(Misc.resolveFile("flash1.png"));
- local flash2 = Graphics.loadImage(Misc.resolveFile("flash2.png"));
- local flash3 = Graphics.loadImage(Misc.resolveFile("flash3.png"));
- local flash4 = Graphics.loadImage(Misc.resolveFile("flash4.png"));
- local flash5 = Graphics.loadImage(Misc.resolveFile("flash5.png"));
- local flash6 = Graphics.loadImage(Misc.resolveFile("flash6.png"));
- local flash7 = Graphics.loadImage(Misc.resolveFile("flash7.png"));
- local flash8 = Graphics.loadImage(Misc.resolveFile("flash8.png"));
- local flash9 = Graphics.loadImage(Misc.resolveFile("flash9.png"));
- local flash10 = Graphics.loadImage(Misc.resolveFile("flash10.png"));
- local flash11 = Graphics.loadImage(Misc.resolveFile("flash11.png"));
- local stargate_star_x = 384;
- local stargate_star_y = -32;
- local stargate_star_cutscene_timer = 0;
- local stargate_star_animation_timer = 0;
- --Custom Coin System
- local GlobalData = Data(Data.DATA_WORLD, "EpisodeData");
- if GlobalData == nil then
- GlobalData:set("CustomCoins", tostring(1))
- GlobalData:save()
- end
- local Coins = GlobalData:get("CustomCoins");
- function onStart()
- Graphics.activateHud(false)
- hudEnabled = true;
- if not allowedCharacters[player.character] then
- player.character = CHARACTER_MARIO;
- end
- end
- function onEvent(eventname)
- if eventname == "Enable Custom HUD" then
- Graphics.activateHud(false)
- hudEnabled = true;
- end
- if eventname == "Reset HUD" then
- Graphics.activateHud(true)
- hudEnabled = false;
- end
- if eventname == "Disable HUD" then
- Graphics.activateHud(false)
- hudEnabled = false;
- end
- if eventname == "Star Gate Open" then
- stargate_star_cutscene_timer = 1
- end
- end
- ---Actual HUD stuff
- function onDraw()
- if freeCamEnabled == true and debugModeOn == true then
- Text.print("FreeCam: On", 20, 560);
- end
- if freeCamEnabled == false and debugModeOn == true then
- Text.print("", 20, 560);
- end
- if (hudEnabled == true) then
- --Score & Stars
- Graphics.drawImage(ui_score, stars_position.x, stars_position.y);
- Text.print(tostring(mem(0x00B2C8E4, FIELD_DWORD)), 1, stars_position.x + 14, stars_position.y + 6);
- Text.print(tostring(mem(0x00B251E0, FIELD_WORD)), 1, stars_position.x + 178, stars_position.y + 10);
- --Lives
- Graphics.drawImage(ui_life, life_position.x, life_position.y);
- Text.print(tostring(mem(0x00B2C5AC, FIELD_FLOAT)), 1, life_position.x + textOffset.x, life_position.y + textOffset.y);
- --Coins
- Graphics.drawImage(ui_coins, coins_position.x, coins_position.y);
- Text.print(Coins, 1, coins_position.x + textOffset.x, coins_position.y + textOffset.y);
- --Box & Hearts
- if player.character <= 2 then
- Graphics.drawImage(ui_box1, box1_position.x - 22, box1_position.y);
- if player.reservePowerup > 0 and player.reservePowerup ~= 34 then
- Graphics.draw{type = RTYPE_IMAGE, x = box1_position.x + 12, y = box1_position.y + 12, image = Graphics.sprites.npc[player.reservePowerup].img}
- end
- if player.reservePowerup == 34 then
- Graphics.drawImage(Graphics.loadImage(Misc.resolveFile("powerup_leaf_middle.png")), box1_position.x + 12, box1_position.y + 12);
- end
- end
- if player.character == 4 then
- Graphics.drawImage(ui_hearts_backdrop, hearts_position.x - 72, hearts_position.y);
- Graphics.drawImage(ui_heart_empty, hearts_position.x - 48, hearts_position.y);
- Graphics.drawImage(ui_heart_empty, hearts_position.x, hearts_position.y);
- Graphics.drawImage(ui_heart_empty, hearts_position.x + 48, hearts_position.y);
- if player:mem(0x16, FIELD_WORD) >= 1 then
- Graphics.drawImage(ui_heart, hearts_position.x - 48, hearts_position.y);
- if player:mem(0x16, FIELD_WORD) >= 2 then
- Graphics.drawImage(ui_heart, hearts_position.x, hearts_position.y);
- if player:mem(0x16, FIELD_WORD) >= 3 then
- Graphics.drawImage(ui_heart, hearts_position.x + 48, hearts_position.y);
- end
- end
- end
- end
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 0 and stargate_star_animation_timer <= 10 then
- Graphics.drawImage(stargate_star1, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 11 and stargate_star_animation_timer <= 20 then
- Graphics.drawImage(stargate_star2, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 21 and stargate_star_animation_timer <= 30 then
- Graphics.drawImage(stargate_star3, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 31 and stargate_star_animation_timer <= 40 then
- Graphics.drawImage(stargate_star4, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 41 and stargate_star_animation_timer <= 50 then
- Graphics.drawImage(stargate_star5, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 51 and stargate_star_animation_timer <= 60 then
- Graphics.drawImage(stargate_star5, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 61 and stargate_star_animation_timer <= 70 then
- Graphics.drawImage(stargate_star6, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 71 and stargate_star_animation_timer <= 80 then
- Graphics.drawImage(stargate_star7, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_animation_timer >= 81 and stargate_star_animation_timer <= 90 then
- Graphics.drawImage(stargate_star8, stargate_star_x, stargate_star_y);
- end
- if stargate_star_cutscene_timer >= 340 and stargate_star_cutscene_timer <= 350 then
- Graphics.drawImage(flash1, 0, 0);
- end
- if stargate_star_cutscene_timer >= 351 and stargate_star_cutscene_timer <= 360 then
- Graphics.drawImage(flash2, 0, 0);
- end
- if stargate_star_cutscene_timer >= 361 and stargate_star_cutscene_timer <= 370 then
- Graphics.drawImage(flash3, 0, 0);
- end
- if stargate_star_cutscene_timer >= 371 and stargate_star_cutscene_timer <= 380 then
- Graphics.drawImage(flash4, 0, 0);
- end
- if stargate_star_cutscene_timer >= 381 and stargate_star_cutscene_timer <= 390 then
- Graphics.drawImage(flash5, 0, 0);
- end
- if stargate_star_cutscene_timer >= 391 and stargate_star_cutscene_timer <= 400 then
- Graphics.drawImage(flash6, 0, 0);
- end
- if stargate_star_cutscene_timer >= 401 and stargate_star_cutscene_timer <= 410 then
- Graphics.drawImage(flash7, 0, 0);
- end
- if stargate_star_cutscene_timer >= 411 and stargate_star_cutscene_timer <= 420 then
- Graphics.drawImage(flash8, 0, 0);
- end
- if stargate_star_cutscene_timer >= 421 and stargate_star_cutscene_timer <= 430 then
- Graphics.drawImage(flash9, 0, 0);
- end
- if stargate_star_cutscene_timer >= 431 and stargate_star_cutscene_timer <= 440 then
- Graphics.drawImage(flash10, 0, 0);
- end
- if stargate_star_cutscene_timer >= 441 and stargate_star_cutscene_timer <= 9999 then
- Graphics.drawImage(flash11, 0, 0);
- end
- if pose == 1 then
- player:mem(0x114, FIELD_WORD, 48)
- end
- end
- function onTick()
- if stargate_star_cutscene_timer >= 1 then
- stargate_star_cutscene_timer = stargate_star_cutscene_timer + 1
- stargate_star_animation_timer = stargate_star_animation_timer + 1
- if stargate_star_animation_timer >= 91 then
- stargate_star_animation_timer = 0
- end
- end
- if stargate_star_cutscene_timer >= 1 and stargate_star_cutscene_timer <= 280 then
- stargate_star_y = stargate_star_y + 1
- end
- if player.altRunKeyPressing == true and freeCamEnabled == false and pressedTanooki == false and debugModeOn == true and player.upKeyPressing == true then
- freeCamEnabled = true
- pressedTanooki = true
- end
- if player.altRunKeyPressing == true and freeCamEnabled == true and pressedTanooki == false and debugModeOn == true and player.upKeyPressing == true then
- freeCamEnabled = false
- pressedTanooki = true
- end
- if player.altRunKeyPressing == false then
- pressedTanooki = false
- end
- if player.altRunKeyPressing == true and pose == 0 and pressedTanooki == false and debugModeOn == true and player.downKeyPressing == true then
- pose = 1
- pressedTanooki = true
- end
- if player.altRunKeyPressing == true and pose == 1 and pressedTanooki == false and debugModeOn == true and player.downKeyPressing == true then
- pose = 0
- pressedTanooki = true
- end
- if freeCamEnabled == true then
- if player.upKeyPressing == true then
- freeCameraY = freeCameraY - 2
- if player.runKeyPressing == true then
- freeCameraY = freeCameraY - 2
- end
- player.upKeyPressing = false
- end
- if player.downKeyPressing == true then
- freeCameraY = freeCameraY + 2
- if player.runKeyPressing == true then
- freeCameraY = freeCameraY + 2
- end
- player.downKeyPressing = false
- end
- if player.rightKeyPressing == true then
- freeCameraX = freeCameraX + 2
- if player.runKeyPressing == true then
- freeCameraX = freeCameraX + 2
- end
- player.rightKeyPressing = false
- end
- if player.leftKeyPressing == true then
- freeCameraX = freeCameraX - 2
- if player.runKeyPressing == true then
- freeCameraX = freeCameraX - 2
- end
- player.leftKeyPressing = false
- end
- player.dropItemKeyPressing = false
- player.runKeyPressing = false
- player.altJumpKeyPressing = false
- player.jumpKeyPressing = false
- end
- if player:mem(0x122, FIELD_WORD) == 0 and previousPowerup ~= player.powerup then
- if previousPowerup > 2 then
- player.powerup = 2
- end
- end
- if player:mem(0x122, FIELD_WORD) == 0 then
- previousPowerup = player.powerup
- end
- end
- function onCameraUpdate()
- if freeCamEnabled == true then
- camera.x = freeCameraX
- camera.y = freeCameraY
- end
- if freeCamEnabled == false then
- freeCameraX = camera.x
- freeCameraY = camera.y
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement