Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///TETRODE 0.20 ALPHA CODE DUMP
- ///CODE FROM CREATE AND STEP EVENT OF PLAYER OBJECT
- ///THIS CODE IS THE PROPERTY OF JULIAN DRAKE, AND MAY ONLY BE USED FOR EDUCATIONAL PURPOSES!
- ///CREATE EVENT
- audio_stop_sound(titlesong) //stop the title music
- //if custom_textures folder does not exist, make it
- if !directory_exists("custom_textures")
- {
- directory_create("custom_textures");
- }
- //if scenarios folder does not exist, make it
- if !directory_exists("scenarios")
- {
- directory_create("scenarios");
- }
- global.worldtype = irandom(1) //set the world type to either:
- //0 - normal
- //1 - snow
- customsprite = false //we are not using a custom sprite
- global.ammo = 30 //start with 30 bullets
- global.flight = 0 //flight is disabled
- global.playerr = 255 //player r is 255
- global.playerg = 255 //player g is 255
- global.playerb = 255 //player b is 255
- global.usecolor = false //these values would only take effect if this was true
- global.currentchest = 0 //we are not in a chest
- global.timedisplay = 0 //do not display the time
- global.minutes = 0; //0 minutes on time display
- global.seconds = 0; //0 seconds on time display
- global.steps = 0; //0 steps on time display
- global.rave = "false" //not in rave mode
- global.walking = false //not in walk mode (does that even exist?)
- global.strictplace = "true" //strict block placement is enabled
- cat1chance = 10 //how many normal cataracts spawn per night
- cat2chance = 3 //how many super cataracts spawn per night
- c1ts = cat1chance //sets "c1ts" to "cat1chance". forget what this does :p
- c2ts = cat2chance //sets "c2ts" to "cat2chance". forget what this does :p
- global.EDN_hour = -1 //start game at night
- global.dbmp = true //something?
- global.init = false //something with checking world status?
- global.spawnt = -1 //spawn timer?
- global.dl = false //do not decrease lag yet
- global.debug = 0 //we are not in debug mode
- dis = false //something
- global.ci = false //something
- global.moving = false //are we moving?
- global.consoletheme = "cmd" //sets the default dev console theme to green and black
- global.inconsole = false //we are not in the console
- global.cod = "" //something
- global.ps = "" //something
- global.iff = 0 //something
- num = 0 //i think this is the screenshot number?
- stc = 0 //no idea what this is
- global.freeslot = false //no free slots are in the inventory (will be set to the right value when game starts)
- global.blevel = 25 //mining laser bullet counter (gui only)
- global.blevel2 = 16 //handgun bullet counter
- global.blevel3 = 50 //assault rifle bullet counter
- if global.set = false{ //if these variables have not yet been set...
- ///Initialize Variables
- grav = 1; //gravity
- hsp = 0; //horizontal speed (don't change)
- vsp = 0; //vertical speed (don't change)
- jumpspeed = 15; //vertical change
- movespeed = 4; //horizontal change
- dir = "right" //face dir
- health = 100 //health
- global.ss = 0 //selected slot
- //global.inv = inventory array
- global.inv[0,0] = 0 //inv slot 1 id
- global.inv[0,1] = 1 //inv slot 1 quantity
- global.inv[1,0] = 9 //inv slot 2 id
- global.inv[1,1] = 1 //inv slot 2 quantity
- global.inv[2,0] = -1 //inv slot 3 id
- global.inv[2,1] = 0 //inv slot 3 quantity
- global.inv[3,0] = -1 //inv slot 4 id
- global.inv[3,1] = 0 //inv slot 4 quantity
- global.inv[4,0] = -1 //inv slot 5 id
- global.inv[4,1] = 0 //inv slot 5 quantity
- alarm[0] = 3 //starts the assault rifle/mining laser shoot loop
- global.wegood = true //humorous name for the same thing as "global.set"
- global.set = true //we are now done loading the player's core variables
- }
- if global.gm = "superhot" //if in superhot gamemode, start with a handgun
- {
- global.inv[0,0] = 4
- global.inv[0,1] = 1
- global.inv[1,0] = -1
- global.inv[1,1] = 0
- global.inv[2,0] = -1
- global.inv[2,1] = 0
- global.inv[3,0] = -1
- global.inv[3,1] = 0
- global.inv[4,0] = -1
- global.inv[4,1] = 0
- }
- if global.gm = "crashed" //if in crashlanded gamemode, give some materials
- {
- global.ammo = 300
- global.inv[0,0] = 3
- global.inv[0,1] = 1
- global.inv[1,0] = 8
- global.inv[1,1] = 1
- global.inv[2,0] = 48
- global.inv[2,1] = 200
- global.inv[3,0] = 27
- global.inv[3,1] = 15
- global.inv[4,0] = 1
- global.inv[4,1] = 50
- }
- if global.gm = "skyblock" //if in skyblock gamemode, give pickaxe, mining laser, and metal blocks
- {
- global.inv[0,0] = 0
- global.inv[0,1] = 1
- global.inv[1,0] = 1
- global.inv[1,1] = 8
- global.inv[2,0] = -1
- global.inv[2,1] = 0
- global.inv[3,0] = -1
- global.inv[3,1] = 0
- global.inv[4,0] = -1
- global.inv[4,1] = 0
- }
- ///Item Defs
- //yo yo listen up we gon' define some items
- global.nummax = 9
- global.iname[0] = "Pickaxe"
- global.iname[1] = "Metal Block"
- global.iname[2] = "Ship Wall"
- global.iname[3] = "Diamond Pickaxe"
- global.iname[4] = "9mm Handgun"
- global.iname[5] = "Grass Block"
- global.iname[6] = "Dirt Block"
- global.iname[7] = "Stone Block"
- global.iname[8] = "Assault Rifle"
- global.iname[9] = "Mining Laser"
- global.iname[10] = "Monster Claw"
- global.iname[11] = "Coal"
- global.iname[12] = "Copper Ingot"
- global.iname[13] = "Wooden Planks"
- global.iname[14] = "Diamond"
- global.iname[15] = "Wooden Bucket"
- global.iname[16] = "Iron Bucket"
- global.iname[17] = "Feather"
- global.iname[18] = "Gold Ingot"
- global.iname[19] = "Health Potion"
- global.iname[20] = "Iron Ingot"
- global.iname[21] = "Water Bucket"
- global.iname[22] = "Leaf"
- global.iname[23] = "Leather"
- global.iname[24] = "Raw Meat"
- global.iname[25] = "Cooked Meat"
- global.iname[26] = "Raw Steak"
- global.iname[27] = "Cooked Steak"
- global.iname[28] = "Oil"
- global.iname[29] = "Copper Ore"
- global.iname[30] = "Diamond Ore"
- global.iname[31] = "Gold Ore"
- global.iname[32] = "Iron Ore"
- global.iname[33] = "Etherium Ore"
- global.iname[34] = "Stone"
- global.iname[35] = "Wooden Logs"
- global.iname[36] = "Sand"
- global.iname[37] = "Acidic Solution"
- global.iname[38] = "Quantum Powder"
- global.iname[39] = "Stick"
- global.iname[40] = "Steel Ingot"
- global.iname[41] = "Tokamak Reactor"
- global.iname[42] = "Energy Trasmitter"
- global.iname[43] = "Wire Spool"
- global.iname[44] = "Pocket Knife"
- global.iname[45] = "Battery Block"
- global.iname[46] = "Solar Panel"
- global.iname[47] = "Wrench"
- global.iname[48] = "Wood Block"
- global.iname[49] = "Caustic Tentacle"
- global.iname[50] = "Railgun"
- global.iname[51] = "Flare Gun"
- global.iname[52] = "Metal Plate"
- global.iname[53] = "Stone Generator"
- global.iname[54] = "Chest"
- global.iname[55] = "Sign"
- global.iname[56] = "Furnace"
- global.iname[57] = "Ammo Clip"
- global.iname[58] = "Sniper Rifle"
- global.iname[59] = "Bricks"
- global.iname[60] = "Potato Knish"
- global.iname[61] = "Mining Drill"
- global.iname[62] = "Molten Rock"
- ///Crafting Defs (not used)
- global.recipes[0,0] = 13
- global.recipes[0,1] = 35
- ///Achievement Progress (says "we have not gotten these achivements yet")
- global.achive1unlocked = false
- global.achive2unlocked = false
- //STEP EVENT
- if place_meeting(x,y+2,obj_mrock) //if on molten rock...
- {
- health = health - 1 //decrease health
- }
- if health < 1 //if you die by this...
- {
- global.cod = "toohot" //your cause of death was "toohot"
- }
- //if place_meeting (x,y,fluid_water) or place_meeting(x,y-1,fluid_water)
- //{
- //if !keyboard_check(vk_shift)
- // {
- //vsp = -3
- // }
- //}
- //if we have not finished the loading process and are in skyblock, start generating some islands
- if global.dl = false
- {
- if global.gm = "skyblock"{
- instance_create(irandom(room_width),irandom(room_height),island_gen)
- }}
- //code for the time counter
- global.steps += 1;
- if global.steps >= room_speed
- {
- global.steps = 0;
- global.seconds += 1;
- if global.seconds >= 60
- {
- global.seconds = 0;
- global.minutes += 1;
- }
- }
- //set the custom player sprites
- if customsprite = false{
- if global.char = "human"
- {
- if global.walking = true
- {
- sprite_index = human
- }
- if global.walking = false
- {
- sprite_index = humanidle
- }
- if global.char = "tetrode"
- {
- sprite_index = sprite0
- }
- if global.char = "cat1"
- {
- sprite_index = cat1
- }
- }}
- //if it's night, spawn some cataracts
- if object_exists(obj_EDN){
- if global.EDN_hour = 0
- {
- cx = irandom(room_width)
- cy = irandom(room_height)
- if c1ts != 0
- {
- c1ts = c1ts - 1
- if place_free(cx,cy)
- {
- if cy >= room_height/2
- {
- instance_create(cx,cy,obj_cat1)
- }
- }
- else
- {
- c1ts = c1ts + 1
- }
- }
- if c2ts != 0
- {
- c2ts = c2ts - 1
- if place_free(cx,cy)
- {
- instance_create(cx,cy,obj_cat2)
- }
- if cy >= room_height/2
- {
- instance_create(cx,cy,obj_cat1)
- }
- else
- {
- c2ts = c2ts + 1
- }
- }
- }}
- if global.EDN_hour = 1
- {
- c1ts = cat1chance
- c2ts = cat2chance
- }
- //set stats for cataract playertype
- if global.char = "cat1"
- {
- grav = 0
- movespeed = 2
- jumpspeed = 15
- }
- //set stats for human playertype
- if global.char = "human"
- {
- grav = 1
- movespeed = 4
- jumpspeed = 10
- }
- //if we're using a custom sprite, make our sprite that sprite
- if customsprite = true
- {
- sprite_index = newskinsprite
- }
- //decreases the level's loading timer
- if global.spawnt != 0 or - 1
- {
- global.spawnt = global.spawnt - 1
- }
- if global.spawnt = 0
- {
- global.dl = true
- }
- if global.ci = true
- {
- if dis = false
- {
- dis = true
- alarm[1] = 5
- }
- }
- //maintain 60 fps (does this even work?)
- if global.gm = "normal"
- {
- if room_speed != real(60)
- {
- room_speed = 60
- }
- }
- //if we die, go to the "you died" screen
- if health < 0
- {
- room_goto(dead)
- }
- //if we have no gun, our bullets have no damage
- global.bdmg = 0
- //no idea what this does
- global.iff = global.iff + 1
- if global.iff = 5
- {
- global.iff = 0
- }
- //loops the var stc (slot to check) through 0-5
- stc = stc + 1
- if stc = 5
- {
- stc = 0
- }
- //infinite health in creative mode
- if global.gm = "creative"
- {
- health = 100
- }
- //keep our player in the level's horizontal border
- x=clamp(x, 32, room_width-32);
- //y=clamp(y, 0, room_height-64);
- //kill the player if they fall out of the world
- if y > room_height
- {
- health = health - 5
- if health < 1
- {
- global.cod = "fall"
- }
- }
- //Get the player's input
- key_right = keyboard_check(ord("D"));
- key_left = -keyboard_check(ord("A"));
- key_jump = keyboard_check_pressed(vk_space);
- key_dec = keyboard_check(vk_shift)
- key_rise = keyboard_check(vk_space)
- //React to inputs
- move = key_left + key_right;
- hsp = move * movespeed;
- if (vsp < 10) vsp += grav;
- if global.gm != "cat"{
- if (place_meeting(x,y+1,blockbase))
- {
- vsp = key_jump * -jumpspeed
- }
- }
- //flight controls for cataract player
- if global.char = "cat1"
- {
- if key_rise
- {
- if place_free(x,y-6)
- {
- y = y - 4
- }
- }
- if key_dec
- {
- if place_free(x,y+6)
- {
- y = y + 4
- }
- }
- }
- //flight controls for creative mode
- if global.gm = "creative"
- {
- if global.flight = 1
- {
- grav = 0
- if key_rise
- {
- if place_free(x,y-10)
- {
- y = y - 8
- }
- }
- if key_dec
- {
- if place_free(x,y+10)
- {
- y = y + 8
- }
- }
- }
- else
- {
- grav = 1
- }
- }
- //Horizontal Collision
- if (place_meeting(x+hsp,y,blockbase))
- {
- while(!place_meeting(x+sign(hsp),y,blockbase))
- {
- x += sign(hsp);
- }
- hsp = 0;
- }
- x += hsp;
- //Vertical Collision
- if (place_meeting(x,y+vsp,blockbase))
- {
- while(!place_meeting(x,y+sign(vsp),blockbase))
- {
- y += sign(vsp);
- }
- vsp = 0;
- }
- y += vsp;
- if keyboard_check(ord("D"))
- {
- global.walking = true
- dir = "right"
- }
- else if keyboard_check(ord("A"))
- {
- global.walking = true
- dir = "left"
- }
- else
- {
- global.walking = false
- }
- //i think this was supposed to shake the ship screen, but it never worked?
- if room_get_name(room) = room0
- {
- __view_set( e__VW.XView, 0, x - irandom(5) + irandom(5 ))
- __view_set( e__VW.YView, 0, y - irandom(5) + irandom(5 ))
- }
- //loop the var num 0-5
- num = num + 1
- if num = 5
- {
- num = 0
- }
- if global.inv[num,1] = 0
- {
- global.freeslot = num
- }
- else
- {
- global.freeslot = false
- }
- //handle the bullet damages for the various guns (may need rebalanced!)
- if global.inv[global.ss,0] = 4
- {
- global.bdmg = 20
- }
- if global.inv[global.ss,0] = 8
- {
- global.bdmg = 10
- }
- if global.inv[global.ss,0] = 9
- {
- global.bdmg = 5
- }
- if global.inv[global.ss,0] = 44
- {
- global.bdmg = 5
- }
- //handle the "time only moves when you do" aspect of SUPERHOT mode
- if global.gm = "superhot"
- {
- if keyboard_check(ord("D")) or keyboard_check(ord("A")) or keyboard_check_pressed(vk_space) or mouse_check_button(mb_left)
- {
- room_speed = real(60)
- }
- if !keyboard_check(ord("D")) and !keyboard_check(ord("A")) and !keyboard_check_pressed(vk_space) and !mouse_check_button(mb_left)
- {
- room_speed = real(2)
- }
- }
- ///handle core fuctions
- if keyboard_check_pressed(ord("R"))
- {
- room_restart();
- }
- if keyboard_check_pressed(ord("R")) and keyboard_check(vk_shift)
- {
- game_restart();
- }
- ///lag decreaser 2000
- if global.dl = true
- {
- //instance_deactivate_object(real_water) //Deactivate water
- instance_deactivate_object(itempickup) //Deactivate dropped items
- instance_deactivate_object(obj_explosion) //Deactivate explosions
- instance_deactivate_object(ebase) //Deactivate entities
- instance_deactivate_object(blockwall) //Deactivate walls
- instance_deactivate_object(blockbase); //Deactivate blocks
- instance_deactivate_object(tmake); //i forget what this is :p
- instance_activate_region(__view_get( e__VW.XView, 0 ),__view_get( e__VW.YView, 0 ),__view_get( e__VW.WView, 0 ),__view_get( e__VW.HView, 0 ),true); //Activate all instances inside view
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement