From bd80cf385a32c29600b62807350a9a0573211452 Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Mon, 10 Aug 2020 10:13:19 +1200 Subject: [PATCH] CommitLog | --- Configs/Default.config.gmx | 8 +- objects/obj_chunk.object.gmx | 87 ++++---- objects/obj_inv_controller.object.gmx | 55 ++--- objects/obj_player.object.gmx | 285 +++++++++----------------- 4 files changed, 166 insertions(+), 269 deletions(-) diff --git a/Configs/Default.config.gmx b/Configs/Default.config.gmx index 0b5d73a..f6680d6 100644 --- a/Configs/Default.config.gmx +++ b/Configs/Default.config.gmx @@ -418,7 +418,7 @@ 0 2048 0 - 0 + -1 -1 1 0 @@ -427,7 +427,7 @@ Memo1 - 0 + -1 0 0 2048 @@ -672,10 +672,10 @@ True 0 -1 - + 1234ABCD-1234-1234-1234-123456789ABC #FFFFFF 1024 - + 1234ABCD diff --git a/objects/obj_chunk.object.gmx b/objects/obj_chunk.object.gmx index ac6535b..9da5575 100644 --- a/objects/obj_chunk.object.gmx +++ b/objects/obj_chunk.object.gmx @@ -80,19 +80,51 @@ for(var xx = 0; xx < CHUNK_SIZE*TILE_SIZE; xx+= TILE_SIZE) 1 - var chunk_total_size = CHUNK_SIZE * TILE_SIZE - - -if(distance_to_object(obj_player) > chunk_total_size*3) + ///Place blocks +if(mouse_check_button_pressed(mb_right) || gamepad_button_check_pressed(0,gp_shoulderl)) { - event_user(0); + if(obj_inv_controller.is_open) + { + return 0; + } + + var selected_item = obj_inv_controller.inventory[obj_hotbar.selected_slot]; + + if(selected_item != 0) + { + var selX = round(mouse_x/TILE_SIZE)*TILE_SIZE; + var selY = round(mouse_y/TILE_SIZE)*TILE_SIZE; + selX -= TILE_SIZE / 2; + selY -= TILE_SIZE / 2; + + var objid = instance_position(selX,selY,obj_placed_item) + if(objid != noone) + { + show_debug_message(string(objid)+", "+string(objid.object_index)); + return 0; + } + + objid = instance_position(selX,selY,obj_player) + if(objid != noone) + { + show_debug_message(string(objid)+", "+string(objid.object_index)); + return 0; + } + + var inst = instance_create(selX,selY,obj_placed_item); + use_item_in_inventory(obj_hotbar.selected_slot); + var chunkid = id; + with(inst){ + inst.ITEM_ID = selected_item; + inst.CHUNK_CONTAINED = chunkid; + } + ds_list_add(instance_list, inst); + } } - - 1 603 @@ -109,43 +141,12 @@ if(distance_to_object(obj_player) > chunk_total_size*3) 1 - ///Place items -if(obj_inv_controller.is_open) + var chunk_total_size = CHUNK_SIZE * TILE_SIZE + + +if(distance_to_object(obj_player) > chunk_total_size*3) { - return 0; -} - -var selected_item = obj_inv_controller.inventory[obj_hotbar.selected_slot]; - -if(selected_item != 0) -{ - var selX = round(mouse_x/TILE_SIZE)*TILE_SIZE; - var selY = round(mouse_y/TILE_SIZE)*TILE_SIZE; - selX -= TILE_SIZE / 2; - selY -= TILE_SIZE / 2; - - var objid = instance_position(selX,selY,obj_placed_item) - if(objid != noone) - { - show_debug_message(string(objid)+", "+string(objid.object_index)); - return 0; - } - - objid = instance_position(selX,selY,obj_player) - if(objid != noone) - { - show_debug_message(string(objid)+", "+string(objid.object_index)); - return 0; - } - - var inst = instance_create(selX,selY,obj_placed_item); - use_item_in_inventory(obj_hotbar.selected_slot); - var chunkid = id; - with(inst){ - inst.ITEM_ID = selected_item; - inst.CHUNK_CONTAINED = chunkid; - } - ds_list_add(instance_list, inst); + event_user(0); } diff --git a/objects/obj_inv_controller.object.gmx b/objects/obj_inv_controller.object.gmx index 0a6383a..a89b05d 100644 --- a/objects/obj_inv_controller.object.gmx +++ b/objects/obj_inv_controller.object.gmx @@ -35,7 +35,7 @@ inv_obj = 0; - + 1 603 @@ -52,42 +52,29 @@ inv_obj = 0; 1 - if(!is_open) + /// Do Controller Stuff +var xx = view_xview[0]+view_wview[0]/2 - (424/2); +var yy = view_yview[0]+view_hview[0]/2 - (254/2); +if(keyboard_check_pressed(ord("E")) || gamepad_button_check_pressed(0,gp_face4)) { - inv_obj = instance_create(0,0,obj_inventory); - is_open = true; + if(!is_open) + { + inv_obj = instance_create(xx,yy,obj_inventory); + is_open = true; + } + else + { + instance_destroy(inv_obj); + is_open = false; + } } -else +if(keyboard_check_pressed(vk_escape) || gamepad_button_check_pressed(0,gp_face2)) { - instance_destroy(inv_obj); - is_open = false; -} - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(is_open) -{ - instance_destroy(inv_obj); - is_open = false; + if(is_open) + { + instance_destroy(inv_obj); + is_open = false; + } } diff --git a/objects/obj_player.object.gmx b/objects/obj_player.object.gmx index 2cfd2cc..52ed596 100644 --- a/objects/obj_player.object.gmx +++ b/objects/obj_player.object.gmx @@ -161,6 +161,103 @@ if(invuln_counter != invuln_counter_max) 1 ///pull_towards_black_holes(); pull_towards_black_holes(); + + + + + + 1 + 603 + 7 + 0 + 0 + -1 + 2 + + + self + 0 + 0 + + + 1 + /// Do Controller Stuff + +if(keyboard_check(ord("A")) || gamepad_button_check(0,gp_padl)) +{ + if(dead == true) + { + return 0; + } + + image_angle += 5; +} +if(keyboard_check(ord("D")) || gamepad_button_check(0,gp_padr)) +{ + if(dead == true) + { + return 0; + } + + image_angle -= 5; +} +if(keyboard_check_pressed(ord("W")) || gamepad_button_check_pressed(0,gp_padu)) +{ + if(dead == true) + { + return 0; + } + + is_moving = true; + audio_play_sound(snd_engine,1,true); + image_index = ship_type+1; +} +if(keyboard_check(ord("W")) || gamepad_button_check(0,gp_padu)) +{ + if(dead == true || speed < 0) + { + return 0; + } + + direction = image_angle + speed += 5 +} +if(keyboard_check_released(ord("W")) || gamepad_button_check_released(0,gp_padu)) +{ + if(dead == true) + { + return 0; + } + + is_moving = false; + audio_stop_sound(snd_engine) + image_index = ship_type; +} + +if((mouse_check_button_pressed(mb_left) && os_type != os_psvita) || gamepad_button_check_pressed(0,gp_shoulderr)) +{ + if(dead == true) + { + return 0; + } + if(obj_inv_controller.is_open) + { + return 0; + } + + + if(energy >= 20) + { + var new_bullet = instance_create(x,y,obj_bullet); + audio_play_sound(snd_shoot,2,false); + new_bullet.image_angle = image_angle; + new_bullet.direction = image_angle; + new_bullet.speed = speed + 5; + energy -= 20; + } + +} + @@ -273,134 +370,6 @@ speed = -20; - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(dead == true || speed < 0) -{ - return 0; -} - -direction = image_angle -speed += 5 - - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(dead == true) -{ - return 0; -} - -image_angle -= 5; - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(dead == true) -{ - return 0; -} - -image_angle += 5; - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(dead == true) -{ - return 0; -} -if(obj_inv_controller.is_open) -{ - return 0; -} - - -if(energy >= 20) -{ - var new_bullet = instance_create(x,y,obj_bullet); - audio_play_sound(snd_shoot,2,false); - new_bullet.image_angle = image_angle; - new_bullet.direction = image_angle; - new_bullet.speed = speed + 5; - energy -= 20; -} - @@ -462,66 +431,6 @@ instance_create(view_xview[0]+(view_wview[0]/2),view_yview[0]+(view_hview[0]/2), ship_type +=2; image_index = ship_type; } - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(dead == true) -{ - return 0; -} - -is_moving = true; -audio_play_sound(snd_engine,1,true); -image_index = ship_type+1; - - - - - - - - 1 - 603 - 7 - 0 - 0 - -1 - 2 - - - self - 0 - 0 - - - 1 - if(dead == true) -{ - return 0; -} - -is_moving = false; -audio_stop_sound(snd_engine) -image_index = ship_type;