Added button stuff that took me way too much to make.

This commit is contained in:
TheGreenTie 2020-02-29 02:20:47 -06:00
parent 8d2b306c90
commit ce074d277a
38 changed files with 441 additions and 69 deletions

View File

@ -1758,6 +1758,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "1087bf1b-acd2-8101-2f92-1c8433c77a66",
"Value": {
"id": "b791b1ee-8d80-0938-476d-cc368f3bf6cc",
"resourcePath": "scripts\\unit_update\\unit_update.yy",
"resourceType": "GMScript"
}
},
{
"Key": "10899d75-79d4-40c0-86b6-a6e064cacc16",
"Value": {
@ -3950,6 +3958,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "29776285-9293-eecd-60ce-080d874ed4ca",
"Value": {
"id": "1eac23f5-f025-308f-bfa2-118e76aa2e95",
"resourcePath": "scripts\\show_shiny_toggle\\show_shiny_toggle.yy",
"resourceType": "GMScript"
}
},
{
"Key": "297829bc-2ffb-4dfc-96f5-1e01f4a2589d",
"Value": {
@ -8118,6 +8134,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "51d00fa8-eb85-4086-a732-a161d9d217d8",
"Value": {
"id": "85207e30-7cc0-3776-b034-06e06a4b170a",
"resourcePath": "scripts/button_set/button_set.yy",
"resourceType": "GMScript"
}
},
{
"Key": "520457af-80ec-44dd-85e5-8f307953d51e",
"Value": {
@ -9150,6 +9174,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "5c7fb6ce-864a-a30e-f665-d51d74835878",
"Value": {
"id": "b026913e-dd7e-6660-4b7f-680e88b86d48",
"resourcePath": "scripts\\button_update_all\\button_update_all.yy",
"resourceType": "GMScript"
}
},
{
"Key": "5c9d469f-abdb-496f-a3f2-51035194d228",
"Value": {
@ -9390,6 +9422,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "5ebf8e8d-9772-aef2-28cb-e8743d4d575d",
"Value": {
"id": "5fbb9f86-4fbb-99cd-ea2a-820b65d5cad0",
"resourcePath": "scripts\\show_galar_toggle\\show_galar_toggle.yy",
"resourceType": "GMScript"
}
},
{
"Key": "5ec6cc19-0ef8-4e87-9158-ca971abf4283",
"Value": {
@ -11038,6 +11078,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "6ee30c99-62bc-bcf5-3853-e159533ab6d0",
"Value": {
"id": "c2bb0f39-a2d2-3f48-0435-8f8ddcd09621",
"resourcePath": "scripts/align_x/align_x.yy",
"resourceType": "GMScript"
}
},
{
"Key": "6ee34a7f-cdd2-4120-b26e-0e2937661526",
"Value": {
@ -14558,6 +14606,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "9081971b-e1be-521f-34be-38fcfa32f684",
"Value": {
"id": "5556752a-d72e-8013-c6ef-9fc461634e8e",
"resourcePath": "scripts/align_y/align_y.yy",
"resourceType": "GMScript"
}
},
{
"Key": "908c902a-4677-4f56-8b5e-792179958c4d",
"Value": {
@ -15090,7 +15146,7 @@
"Key": "961739d9-bcef-9d3d-a9a7-6d0487191e8e",
"Value": {
"id": "cf68e563-92be-d148-9a63-2bb86baa8cc2",
"resourcePath": "scripts\/icon_path_get\/icon_path_get.yy",
"resourcePath": "scripts/icon_path_get/icon_path_get.yy",
"resourceType": "GMScript"
}
},
@ -18574,6 +18630,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "b97fbe91-98d6-26ce-4811-7421bc2b6bb3",
"Value": {
"id": "ac2426ac-7ba1-8bcd-9775-514bd60d22c4",
"resourcePath": "objects\\obj_button\\obj_button.yy",
"resourceType": "GMObject"
}
},
{
"Key": "b98d5ae0-74d0-47ca-973c-707d560affd5",
"Value": {
@ -19278,6 +19342,14 @@
"resourceType": "GMIncludedFile"
}
},
{
"Key": "c07397b8-105a-cf00-f119-47f5091762ab",
"Value": {
"id": "2118ddc8-b565-6867-0098-ac738fe2864d",
"resourcePath": "scripts\\button_create\\button_create.yy",
"resourceType": "GMScript"
}
},
{
"Key": "c077afd4-a5a5-4e26-b855-c91c50d6095f",
"Value": {
@ -25493,7 +25565,15 @@
"01109f28-4eca-fc23-b0d9-649acb9c158c",
"0c8bde50-6fda-efe6-8809-de6b265ccbcc",
"cf1f53d0-1b66-da1a-c70e-53a1d7177805",
"d586db78-0f49-acc1-1594-f50f2a038c70"
"d586db78-0f49-acc1-1594-f50f2a038c70",
"29776285-9293-eecd-60ce-080d874ed4ca",
"5ebf8e8d-9772-aef2-28cb-e8743d4d575d",
"c07397b8-105a-cf00-f119-47f5091762ab",
"51d00fa8-eb85-4086-a732-a161d9d217d8",
"5c7fb6ce-864a-a30e-f665-d51d74835878",
"6ee30c99-62bc-bcf5-3853-e159533ab6d0",
"9081971b-e1be-521f-34be-38fcfa32f684",
"1087bf1b-acd2-8101-2f92-1c8433c77a66"
],
"tutorial": ""
}

View File

@ -0,0 +1,6 @@
enum but { plus, minus, method }
hover = false;
pressed = false;
inverse = 1;

View File

@ -0,0 +1,24 @@
//draw_sprite_stretched(sprite_index, image_index, x, y, width, -height);
if (!pressed)
{
var plus = 0;
var inverse = 1;
}
else
{
var plus = height;
var inverse = -1;
}
draw_sprite_ext(sprite_index, image_index, x, y+plus, scale*length, scale*inverse, image_angle, image_blend, image_alpha);
draw_set_font(global.font)
draw_set_color(color)
draw_set_halign(halign);
draw_set_valign(valign);
draw_text_transformed(x+width/2, y+height/2+plus/6, text, scale, scale, image_angle);
draw_set_halign(fa_left);
draw_set_valign(fa_top);

View File

@ -0,0 +1,24 @@
if (mouse_x>x && mouse_x<x+width && mouse_y>y && mouse_y<y+height)
{
hover = true;
color = c_red;
if (mouse_check_button_pressed(mb_left))
pressed = true;
}
else
{
hover = false;
color = c_white;
}
if (mouse_check_button_released(mb_left))
{
if (hover)
{
}
pressed = false;
}

View File

@ -0,0 +1,60 @@
{
"id": "b97fbe91-98d6-26ce-4811-7421bc2b6bb3",
"modelName": "GMObject",
"mvc": "1.0",
"name": "obj_button",
"eventList": [
{
"id": "d6854f77-a319-ddf1-748b-cbf6e970cb22",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"eventtype": 0,
"enumb": 0,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"m_owner": "b97fbe91-98d6-26ce-4811-7421bc2b6bb3"
},
{
"id": "ddca3561-dcbc-dafb-84b1-31652612218a",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"eventtype": 8,
"enumb": 0,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"m_owner": "b97fbe91-98d6-26ce-4811-7421bc2b6bb3"
},
{
"id": "fbf149ae-484d-1ba1-7dd1-2cdd91c6acc5",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"eventtype": 3,
"enumb": 0,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"m_owner": "b97fbe91-98d6-26ce-4811-7421bc2b6bb3"
}
],
"maskSpriteId": "00000000-0000-0000-0000-000000000000",
"overriddenProperties": null,
"parentObjectId": "00000000-0000-0000-0000-000000000000",
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 0,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": null,
"physicsStartAwake": true,
"properties": [
],
"solid": false,
"spriteId": "55447b82-1730-4429-a3f8-d81a83dcacf6",
"visible": true
}

View File

@ -2,6 +2,11 @@
dex_data_load();
initials_set();
savedata_load();
dex_galar_load(global.show_galar);
dex_galar_load();
boxes_spawn();
scr_window_resize();
button_create(0, 0, but.plus);
button_create(0, 0, but.minus);
button_update_all();

View File

@ -1,10 +1 @@
global.show_galar = !global.show_galar
if (file_exists("save.ini"))
{
ini_open("save.ini")
ini_write_real("Display", "Galar Dex", global.show_galar);
ini_close();
}
room_restart();
show_galar_toggle();

View File

@ -1,10 +1 @@
global.show_shiny = !global.show_shiny
if (file_exists("save.ini"))
{
ini_open("save.ini")
ini_write_real("Display", "Shiny Mode", global.show_shiny);
ini_close();
}
room_restart();
show_shiny_toggle();

View File

@ -4,30 +4,8 @@ draw_set_color(c_white);
draw_self();
// Scaling
//image_xscale = global.icon_scale;
//image_yscale = global.icon_scale;
/// DRAW
/*
// Slot + Color
draw_set_color(color);
draw_rectangle(x+1, y+1, x+global.box_scale-1, y+global.box_scale-1, false);
draw_set_color(c_white);
draw_self();
*/
// Sprite
sprite_wiggly();
if (spr != -1)
draw_sprite_ext(spr, 0, x+global.box_scale/2+plus_x, y+global.box_scale/2+plus_y, global.icon_scale*spr_plus, global.icon_scale*spr_plus, image_angle, image_blend, image_alpha);
/* */
/* */

View File

@ -5,22 +5,12 @@
"name": "obj_slot",
"eventList": [
{
"id": "6ae64891-4200-49aa-8c64-f1f8248dbc76",
"id": "570e5426-70e7-44c1-b828-fcb1b87b74fc",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 57,
"eventtype": 6,
"m_owner": "3a15f260-5195-42e7-9d02-78cb32aeb14e"
},
{
"id": "d76e2d2b-e599-4559-a04c-7bdfa346c877",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 11,
"enumb": 5,
"eventtype": 6,
"m_owner": "3a15f260-5195-42e7-9d02-78cb32aeb14e"
},
@ -35,12 +25,22 @@
"m_owner": "3a15f260-5195-42e7-9d02-78cb32aeb14e"
},
{
"id": "570e5426-70e7-44c1-b828-fcb1b87b74fc",
"id": "d76e2d2b-e599-4559-a04c-7bdfa346c877",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 5,
"enumb": 11,
"eventtype": 6,
"m_owner": "3a15f260-5195-42e7-9d02-78cb32aeb14e"
},
{
"id": "6ae64891-4200-49aa-8c64-f1f8248dbc76",
"modelName": "GMEvent",
"mvc": "1.0",
"IsDnD": false,
"collisionObjectId": "00000000-0000-0000-0000-000000000000",
"enumb": 57,
"eventtype": 6,
"m_owner": "3a15f260-5195-42e7-9d02-78cb32aeb14e"
},

View File

@ -0,0 +1,15 @@
///align_x(region, unit%)
var zone = argument0;
var percent = argument1;
switch(zone)
{
case region.mid_right:
var x_start = global.window_width*0.75 + global.window_width*0.25/2;
break;
}
var deplacement = global.unit * percent;
return x_start + deplacement - (sprite_get_width(sprite_index) * scale * length)/2;

View File

@ -0,0 +1,8 @@
{
"id": "6ee30c99-62bc-bcf5-3853-e159533ab6d0",
"modelName": "GMScript",
"mvc": "1.0",
"name": "align_x",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -0,0 +1,15 @@
///align_y(region, unit%)
var zone = argument0;
var percent = argument1;
switch(zone)
{
case region.mid_right:
var y_start = global.window_height * 0.7;
break;
}
var deplacement = global.unit * percent;
return y_start + deplacement - (sprite_get_height(sprite_index) * scale)/2;

View File

@ -0,0 +1,8 @@
{
"id": "9081971b-e1be-521f-34be-38fcfa32f684",
"modelName": "GMScript",
"mvc": "1.0",
"name": "align_y",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -0,0 +1,4 @@
///button_create(x, y, type)
with (instance_create_depth(0, 0, depth-1, obj_button))
button_set(argument0, argument1, argument2);

View File

@ -0,0 +1,8 @@
{
"id": "c07397b8-105a-cf00-f119-47f5091762ab",
"modelName": "GMScript",
"mvc": "1.0",
"name": "button_create",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -0,0 +1,39 @@
///button_set(x_, y_, type)
x_ = argument0;
y_ = argument1;
type = argument2;
image_speed = 0;
length = 0.25;
scale = global.icon_scale;
color = c_white;
halign = fa_center;
valign = fa_middle;
switch(type)
{
case but.plus:
text = "+";
image_index = 4;
scale = global.icon_scale * 1.5;
x_ = align_x(region.mid_right, 1.75);
y_ = align_y(region.mid_right, 0);
break;
case but.minus:
text = "-";
image_index = 4;
x_ = align_x(region.mid_right, -2);
y_ = align_y(region.mid_right, 0);
break;
};
x = x_;
y = __view_get(e__VW.YView, 0) + y_;
width = sprite_get_width(sprite_index) * scale * length;
height = sprite_get_height(sprite_index) * scale;

View File

@ -0,0 +1,8 @@
{
"id": "51d00fa8-eb85-4086-a732-a161d9d217d8",
"modelName": "GMScript",
"mvc": "1.0",
"name": "button_set",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -0,0 +1,5 @@
///button_update_all()
if (instance_exists(obj_button))
with (obj_button)
button_set(x_, y_, type);

View File

@ -0,0 +1,8 @@
{
"id": "5c7fb6ce-864a-a30e-f665-d51d74835878",
"modelName": "GMScript",
"mvc": "1.0",
"name": "button_update_all",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -22,4 +22,4 @@ if (file_exists("save.ini"))
ini_close();
}
else
show_debug_message("ERROR: Save file somehow went missing.");
show_debug_message("ERROR: Save file somehow went missing.");

View File

@ -1,4 +1,4 @@
///dex_galar_load(bool)
///dex_galar_load()
// Galar Dex data loading
@ -11,5 +11,5 @@ enum gdex
type2
}
if (argument0)
if (global.show_galar)
global.galardata = csv_load("galardex");

View File

@ -1,12 +1,23 @@
/// @description draw_guidelines(debug only?)
/// @param debug only?
if (!argument0 || debug_mode)
if (argument0 || debug_mode)
{
// Upper
draw_rectangle(global.window_width/2, __view_get( e__VW.YView, 0 ), global.window_width-1, global.window_height*0.6+__view_get( e__VW.YView, 0 ), true)
draw_rectangle(global.window_width/2, global.window_height*0.6+__view_get( e__VW.YView, 0 ), global.window_width-1, global.window_height*0.8+__view_get( e__VW.YView, 0 ), true)
// Mid-Left
draw_rectangle(global.window_width/2, global.window_height*0.6+__view_get( e__VW.YView, 0 ), global.window_width*0.75-1, global.window_height*0.8+__view_get( e__VW.YView, 0 ), true)
// Mid-Right
draw_rectangle(global.window_width*0.75, global.window_height*0.6+__view_get( e__VW.YView, 0 ), global.window_width-1, global.window_height*0.8+__view_get( e__VW.YView, 0 ), true)
draw_line_color(global.window_width*0.75 + global.window_width*0.25/2, global.window_height*0.6+__view_get( e__VW.YView, 0 ), global.window_width*0.75 + global.window_width*0.25/2, global.window_height*0.8+__view_get( e__VW.YView, 0 ), c_green, c_green)
draw_line_color(global.window_width*0.75, global.window_height * 0.7+__view_get( e__VW.YView, 0 ), global.window_width, global.window_height * 0.7+__view_get( e__VW.YView, 0 ), c_green, c_green)
// Bottom
draw_rectangle(global.window_width/2, global.window_height*0.8+__view_get( e__VW.YView, 0 ), global.window_width-1, global.window_height-1+__view_get( e__VW.YView, 0 ), true)
// Pokémon
if (sprite_exists(global.selected[dex.sprite]))
draw_rectangle( global.window_width*0.75 - sprite_get_width(global.selected[dex.sprite])/2 * global.icon_scale*3,
global.window_height*global.hud_pokemon_rate - sprite_get_height(global.selected[dex.sprite])/2 * global.icon_scale*3 + __view_get( e__VW.YView, 0 ),

View File

@ -20,7 +20,7 @@ if (!file_exists(filename))
file_text_writeln(log);
file_text_close(log);
show_debug_message("Missing Icon: "+str+" ("+folder+")");
//show_debug_message("Missing Icon: "+str+" ("+folder+")");
if (shiny)
return icon_path_get(str, false);

View File

@ -11,7 +11,7 @@ global.window_height = window_get_height();
global.box_len = global.window_width/2/7;
global.icon_scale = 2;
global.font = font_add_sprite_ext(spr_font,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZéÉ#-'!?():@_.% /♂♀",true,1)
global.font = font_add_sprite_ext(spr_font,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZéÉ#-'!?():@_.% /♂♀+", true, 1);
global.selected[dex.dexno] = "001";
global.selected[dex.pokemon] = "BULBASAUR";
@ -29,4 +29,6 @@ global.mouse_x_prev = mouse_x;
global.mouse_y_prev = mouse_x;
global.various = false;
global.various_to = 0;
global.various_to = 0;
enum region { boxes, top, mid_left, mid_right, bottom }

View File

@ -43,6 +43,8 @@ with (obj_slot)
scroll_warp();
}
unit_update();
button_update_all();
room_width = global.window_width;

View File

@ -13,4 +13,6 @@ else
scroll_warp();
button_update_all();
show_debug_message("Scrolled to Box "+string(global.current_box));

View File

@ -0,0 +1,10 @@
global.show_galar = !global.show_galar
if (file_exists("save.ini"))
{
ini_open("save.ini")
ini_write_real("Display", "Galar Dex", global.show_galar);
ini_close();
}
room_restart();

View File

@ -0,0 +1,8 @@
{
"id": "5ebf8e8d-9772-aef2-28cb-e8743d4d575d",
"modelName": "GMScript",
"mvc": "1.0",
"name": "show_galar_toggle",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -0,0 +1,12 @@
///show_shiny_toggle()
global.show_shiny = !global.show_shiny
if (file_exists("save.ini"))
{
ini_open("save.ini")
ini_write_real("Display", "Shiny Mode", global.show_shiny);
ini_close();
}
room_restart();

View File

@ -0,0 +1,8 @@
{
"id": "29776285-9293-eecd-60ce-080d874ed4ca",
"modelName": "GMScript",
"mvc": "1.0",
"name": "show_shiny_toggle",
"IsCompatibility": false,
"IsDnD": false
}

View File

@ -0,0 +1 @@
global.unit = sprite_get_height(spr_source) * global.icon_scale;

View File

@ -0,0 +1,8 @@
{
"id": "1087bf1b-acd2-8101-2f92-1c8433c77a66",
"modelName": "GMScript",
"mvc": "1.0",
"name": "unit_update",
"IsCompatibility": false,
"IsDnD": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

View File

@ -1202,6 +1202,28 @@
"LayerId": "e69b6581-b178-4877-915f-d3e726eaa004"
}
]
},
{
"id": "2298688a-9dc0-4af1-9e80-9e3829ee63ee",
"modelName": "GMSpriteFrame",
"mvc": "1.0",
"SpriteId": "a6bfc673-f83a-4ef8-9157-215789abf337",
"compositeImage": {
"id": "92e0a7ec-df64-4696-9937-fde77ac683c7",
"modelName": "GMSpriteImage",
"mvc": "1.0",
"FrameId": "2298688a-9dc0-4af1-9e80-9e3829ee63ee",
"LayerId": "00000000-0000-0000-0000-000000000000"
},
"images": [
{
"id": "11af2d40-d45d-40e7-b53c-07c43e34923d",
"modelName": "GMSpriteImage",
"mvc": "1.0",
"FrameId": "2298688a-9dc0-4af1-9e80-9e3829ee63ee",
"LayerId": "e69b6581-b178-4877-915f-d3e726eaa004"
}
]
}
],
"gridX": 0,

View File

@ -6,7 +6,8 @@
"children": [
"b5a21a9b-6e2e-40d3-9039-73cd19a7b959",
"3a15f260-5195-42e7-9d02-78cb32aeb14e",
"7cfea35a-80a9-403d-8c4d-28ca4c884ac0"
"7cfea35a-80a9-403d-8c4d-28ca4c884ac0",
"b97fbe91-98d6-26ce-4811-7421bc2b6bb3"
],
"filterType": "GMObject",
"folderName": "objects",

View File

@ -42,7 +42,15 @@
"01109f28-4eca-fc23-b0d9-649acb9c158c",
"0c8bde50-6fda-efe6-8809-de6b265ccbcc",
"cf1f53d0-1b66-da1a-c70e-53a1d7177805",
"d586db78-0f49-acc1-1594-f50f2a038c70"
"d586db78-0f49-acc1-1594-f50f2a038c70",
"29776285-9293-eecd-60ce-080d874ed4ca",
"5ebf8e8d-9772-aef2-28cb-e8743d4d575d",
"c07397b8-105a-cf00-f119-47f5091762ab",
"51d00fa8-eb85-4086-a732-a161d9d217d8",
"5c7fb6ce-864a-a30e-f665-d51d74835878",
"6ee30c99-62bc-bcf5-3853-e159533ab6d0",
"9081971b-e1be-521f-34be-38fcfa32f684",
"1087bf1b-acd2-8101-2f92-1c8433c77a66"
],
"filterType": "GMScript",
"folderName": "scripts",