From 1422f3fa4be2eb1c58701e1d8ab072514d2d30a9 Mon Sep 17 00:00:00 2001 From: katsaii Date: Sun, 2 Jul 2023 17:28:44 +0100 Subject: [PATCH] chaos, added collision boxes --- datafiles/.gitignore | 2 + disarm.resource_order | 7 + disarm.yyp | 70 ++++--- .../obj_disarm_example/obj_disarm_example.yy | 57 +++--- options/html5/options_html5.yy | 49 +++-- options/linux/options_linux.yy | 31 ++- options/mac/options_mac.yy | 48 ++--- options/main/options_main.yy | 25 ++- options/operagx/options_operagx.yy | 26 ++- options/windows/options_windows.yy | 46 ++--- rooms/rm_test/rm_test.yy | 79 ++++---- scripts/scr_disarm/scr_disarm.gml | 189 ++++++++++++++++-- scripts/scr_disarm/scr_disarm.yy | 9 +- 13 files changed, 408 insertions(+), 230 deletions(-) create mode 100644 datafiles/.gitignore create mode 100644 disarm.resource_order diff --git a/datafiles/.gitignore b/datafiles/.gitignore new file mode 100644 index 0000000..4c73c61 --- /dev/null +++ b/datafiles/.gitignore @@ -0,0 +1,2 @@ +level1boss* +readyboss* \ No newline at end of file diff --git a/disarm.resource_order b/disarm.resource_order new file mode 100644 index 0000000..223ac41 --- /dev/null +++ b/disarm.resource_order @@ -0,0 +1,7 @@ +{ + "FolderOrderSettings": [], + "ResourceOrderSettings": [ + {"name":"scr_disarm","order":1,"path":"scripts/scr_disarm/scr_disarm.yy",}, + {"name":"rm_test","order":11,"path":"rooms/rm_test/rm_test.yy",}, + ], +} \ No newline at end of file diff --git a/disarm.yyp b/disarm.yyp index 14f6199..68fb164 100644 --- a/disarm.yyp +++ b/disarm.yyp @@ -1,48 +1,46 @@ { - "resources": [ - {"id":{"name":"obj_disarm_example","path":"objects/obj_disarm_example/obj_disarm_example.yy",},"order":0,}, - {"id":{"name":"scr_disarm","path":"scripts/scr_disarm/scr_disarm.yy",},"order":1,}, - {"id":{"name":"rm_test","path":"rooms/rm_test/rm_test.yy",},"order":11,}, - ], - "Options": [ - {"name":"Linux","path":"options/linux/options_linux.yy",}, - {"name":"macOS","path":"options/mac/options_mac.yy",}, - {"name":"Main","path":"options/main/options_main.yy",}, - {"name":"Windows","path":"options/windows/options_windows.yy",}, - {"name":"HTML5","path":"options/html5/options_html5.yy",}, - {"name":"operagx","path":"options/operagx/options_operagx.yy",}, + "resourceType": "GMProject", + "resourceVersion": "1.7", + "name": "disarm", + "AudioGroups": [ + {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, ], - "defaultScriptType": 1, - "isEcma": false, "configs": { - "name": "Default", "children": [], + "name": "Default", }, - "RoomOrderNodes": [ - {"roomId":{"name":"rm_test","path":"rooms/rm_test/rm_test.yy",},}, - ], + "defaultScriptType": 1, "Folders": [ - {"folderPath":"folders/Disarm.yy","order":10,"resourceVersion":"1.0","name":"Disarm","tags":[],"resourceType":"GMFolder",}, - ], - "AudioGroups": [ - {"targets":-1,"resourceVersion":"1.3","name":"audiogroup_default","resourceType":"GMAudioGroup",}, - ], - "TextureGroups": [ - {"isScaled":true,"compressFormat":"bz2","autocrop":true,"border":2,"mipsToGenerate":0,"groupParent":null,"targets":-1,"resourceVersion":"1.3","name":"Default","resourceType":"GMTextureGroup",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Disarm","folderPath":"folders/Disarm.yy",}, ], "IncludedFiles": [ - {"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"armature.scon","resourceType":"GMIncludedFile",}, - {"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"armature.json","resourceType":"GMIncludedFile",}, - {"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"armature.png","resourceType":"GMIncludedFile",}, - {"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"wanda.json","resourceType":"GMIncludedFile",}, - {"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"wanda.png","resourceType":"GMIncludedFile",}, - {"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"wanda.scon","resourceType":"GMIncludedFile",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"armature.json","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"armature.png","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"armature.scon","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"level1boss.json","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"level1boss.png","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"level1boss.scon","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"readyboss.json","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"readyboss.png","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"readyboss.scon","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"wanda.json","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"wanda.png","CopyToMask":-1,"filePath":"datafiles",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"wanda.scon","CopyToMask":-1,"filePath":"datafiles",}, ], + "isEcma": false, + "LibraryEmitters": [], "MetaData": { - "IDEVersion": "2022.6.1.26", + "IDEVersion": "2023.4.0.84", }, - "resourceVersion": "1.5", - "name": "disarm", - "tags": [], - "resourceType": "GMProject", + "resources": [ + {"id":{"name":"obj_disarm_example","path":"objects/obj_disarm_example/obj_disarm_example.yy",},}, + {"id":{"name":"scr_disarm","path":"scripts/scr_disarm/scr_disarm.yy",},}, + {"id":{"name":"rm_test","path":"rooms/rm_test/rm_test.yy",},}, + ], + "RoomOrderNodes": [ + {"roomId":{"name":"rm_test","path":"rooms/rm_test/rm_test.yy",},}, + ], + "TextureGroups": [ + {"resourceType":"GMTextureGroup","resourceVersion":"1.3","name":"Default","autocrop":true,"border":2,"compressFormat":"bz2","directory":"","groupParent":null,"isScaled":true,"loadType":"default","mipsToGenerate":0,"targets":-1,}, + ], } \ No newline at end of file diff --git a/objects/obj_disarm_example/obj_disarm_example.yy b/objects/obj_disarm_example/obj_disarm_example.yy index 36e12d2..911c63e 100644 --- a/objects/obj_disarm_example/obj_disarm_example.yy +++ b/objects/obj_disarm_example/obj_disarm_example.yy @@ -1,38 +1,37 @@ { - "spriteId": null, - "solid": false, - "visible": true, - "managed": true, - "spriteMaskId": null, - "persistent": false, - "parentObjectId": null, - "physicsObject": false, - "physicsSensor": false, - "physicsShape": 1, - "physicsGroup": 1, - "physicsDensity": 0.5, - "physicsRestitution": 0.1, - "physicsLinearDamping": 0.1, - "physicsAngularDamping": 0.1, - "physicsFriction": 0.2, - "physicsStartAwake": true, - "physicsKinematic": false, - "physicsShapePoints": [], + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "obj_disarm_example", "eventList": [ - {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, - {"isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, - {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, - {"isDnD":false,"eventNum":1,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, - {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,}, ], - "properties": [], + "managed": true, "overriddenProperties": [], "parent": { "name": "Disarm", "path": "folders/Disarm.yy", }, - "resourceVersion": "1.0", - "name": "obj_disarm_example", - "tags": [], - "resourceType": "GMObject", + "parentObjectId": null, + "persistent": false, + "physicsAngularDamping": 0.1, + "physicsDensity": 0.5, + "physicsFriction": 0.2, + "physicsGroup": 1, + "physicsKinematic": false, + "physicsLinearDamping": 0.1, + "physicsObject": false, + "physicsRestitution": 0.1, + "physicsSensor": false, + "physicsShape": 1, + "physicsShapePoints": [], + "physicsStartAwake": true, + "properties": [], + "solid": false, + "spriteId": null, + "spriteMaskId": null, + "visible": true, } \ No newline at end of file diff --git a/options/html5/options_html5.yy b/options/html5/options_html5.yy index dddd69e..1cbefcf 100644 --- a/options/html5/options_html5.yy +++ b/options/html5/options_html5.yy @@ -1,34 +1,33 @@ { - "option_html5_browser_title": "Created with GameMaker Studio 2", - "option_html5_version": "1.0.0.0", - "option_html5_foldername": "html5game", - "option_html5_outputname": "index.html", - "option_html5_splash_png": "${base_options_dir}/html5/splash.png", - "option_html5_usesplash": false, - "option_html5_outputdebugtoconsole": true, - "option_html5_display_cursor": true, - "option_html5_localrunalert": true, - "option_html5_index": "use_default", - "option_html5_loadingbar": "Use Default", - "option_html5_jsprepend": "", - "option_html5_icon": "${base_options_dir}/html5/fav.ico", + "resourceType": "GMHtml5Options", + "resourceVersion": "1.0", + "name": "HTML5", "option_html5_allow_fullscreen": true, - "option_html5_interpolate_pixels": true, + "option_html5_browser_title": "Created with GameMaker Studio 2", "option_html5_centregame": true, - "option_html5_usebuiltinparticles": true, - "option_html5_usebuiltinfont": true, - "option_html5_webgl": 2, - "option_html5_scale": 0, - "option_html5_texture_page": "2048x2048", - "option_html5_use_facebook": false, - "option_html5_facebook_id": "", + "option_html5_display_cursor": true, "option_html5_facebook_app_display_name": "", + "option_html5_facebook_id": "", "option_html5_flurry_enable": false, "option_html5_flurry_id": "", + "option_html5_foldername": "html5game", "option_html5_google_analytics_enable": false, "option_html5_google_tracking_id": "", - "resourceVersion": "1.0", - "name": "HTML5", - "tags": [], - "resourceType": "GMHtml5Options", + "option_html5_icon": "${base_options_dir}/html5/fav.ico", + "option_html5_index": "use_default", + "option_html5_interpolate_pixels": true, + "option_html5_jsprepend": "", + "option_html5_loadingbar": "Use Default", + "option_html5_localrunalert": true, + "option_html5_outputdebugtoconsole": true, + "option_html5_outputname": "index.html", + "option_html5_scale": 0, + "option_html5_splash_png": "${base_options_dir}/html5/splash.png", + "option_html5_texture_page": "2048x2048", + "option_html5_use_facebook": false, + "option_html5_usebuiltinfont": true, + "option_html5_usebuiltinparticles": true, + "option_html5_usesplash": false, + "option_html5_version": "1.0.0.0", + "option_html5_webgl": 2, } \ No newline at end of file diff --git a/options/linux/options_linux.yy b/options/linux/options_linux.yy index 4978896..652b3f5 100644 --- a/options/linux/options_linux.yy +++ b/options/linux/options_linux.yy @@ -1,25 +1,24 @@ { + "resourceType": "GMLinuxOptions", + "resourceVersion": "1.0", + "name": "Linux", + "option_linux_allow_fullscreen": false, + "option_linux_disable_sandbox": false, + "option_linux_display_cursor": true, "option_linux_display_name": "Created with GameMaker Studio 2", - "option_linux_version": "1.0.0.0", - "option_linux_maintainer_email": "", - "option_linux_homepage": "http://www.yoyogames.com", - "option_linux_short_desc": "", - "option_linux_long_desc": "", - "option_linux_splash_screen": "${base_options_dir}/linux/splash/splash.png", "option_linux_display_splash": false, + "option_linux_enable_steam": false, + "option_linux_homepage": "http://www.yoyogames.com", "option_linux_icon": "${base_options_dir}/linux/icons/64.png", - "option_linux_start_fullscreen": false, - "option_linux_allow_fullscreen": false, "option_linux_interpolate_pixels": true, - "option_linux_display_cursor": true, - "option_linux_sync": false, + "option_linux_long_desc": "", + "option_linux_maintainer_email": "", "option_linux_resize_window": false, "option_linux_scale": 0, + "option_linux_short_desc": "", + "option_linux_splash_screen": "${base_options_dir}/linux/splash/splash.png", + "option_linux_start_fullscreen": false, + "option_linux_sync": false, "option_linux_texture_page": "2048x2048", - "option_linux_enable_steam": false, - "option_linux_disable_sandbox": false, - "resourceVersion": "1.0", - "name": "Linux", - "tags": [], - "resourceType": "GMLinuxOptions", + "option_linux_version": "1.0.0.0", } \ No newline at end of file diff --git a/options/mac/options_mac.yy b/options/mac/options_mac.yy index 73e249f..5c7be78 100644 --- a/options/mac/options_mac.yy +++ b/options/mac/options_mac.yy @@ -1,33 +1,35 @@ { - "option_mac_display_name": "Created with GameMaker Studio 2", + "resourceType": "GMMacOptions", + "resourceVersion": "1.0", + "name": "macOS", + "option_mac_allow_fullscreen": false, + "option_mac_allow_incoming_network": false, + "option_mac_allow_outgoing_network": false, + "option_mac_app_category": "Games", "option_mac_app_id": "com.company.game", - "option_mac_version": "1.0.0.0", - "option_mac_output_dir": "~/gamemakerstudio2", - "option_mac_team_id": "", - "option_mac_signing_identity": "Developer ID Application:", + "option_mac_apple_sign_in": false, + "option_mac_arm64": true, + "option_mac_build_app_store": false, "option_mac_copyright": "", - "option_mac_splash_png": "${base_options_dir}/mac/splash/splash.png", + "option_mac_disable_sandbox": false, + "option_mac_display_cursor": true, + "option_mac_display_name": "Created with GameMaker Studio 2", + "option_mac_enable_retina": false, + "option_mac_enable_steam": false, "option_mac_icon_png": "${base_options_dir}/mac/icons/1024.png", "option_mac_installer_background_png": "${base_options_dir}/mac/splash/installer_background.png", - "option_mac_menu_dock": false, - "option_mac_display_cursor": true, - "option_mac_start_fullscreen": false, - "option_mac_allow_fullscreen": false, "option_mac_interpolate_pixels": true, - "option_mac_vsync": false, + "option_mac_menu_dock": false, + "option_mac_min_version": "10.10", + "option_mac_output_dir": "~/gamemakerstudio2", "option_mac_resize_window": false, - "option_mac_enable_retina": false, "option_mac_scale": 0, + "option_mac_signing_identity": "Developer ID Application:", + "option_mac_splash_png": "${base_options_dir}/mac/splash/splash.png", + "option_mac_start_fullscreen": false, + "option_mac_team_id": "", "option_mac_texture_page": "2048x2048", - "option_mac_build_app_store": false, - "option_mac_allow_incoming_network": false, - "option_mac_allow_outgoing_network": false, - "option_mac_app_category": "Games", - "option_mac_enable_steam": false, - "option_mac_disable_sandbox": false, - "option_mac_apple_sign_in": false, - "resourceVersion": "1.0", - "name": "macOS", - "tags": [], - "resourceType": "GMMacOptions", + "option_mac_version": "1.0.0.0", + "option_mac_vsync": false, + "option_mac_x86_64": true, } \ No newline at end of file diff --git a/options/main/options_main.yy b/options/main/options_main.yy index a0af855..7d33714 100644 --- a/options/main/options_main.yy +++ b/options/main/options_main.yy @@ -1,21 +1,20 @@ { + "resourceType": "GMMainOptions", + "resourceVersion": "1.4", + "name": "Main", + "option_author": "", + "option_collision_compatibility": true, + "option_copy_on_write_enabled": true, + "option_draw_colour": 4294967295, + "option_game_speed": 60, "option_gameguid": "b19506d5-53a7-4405-966e-4fbe5e8a494c", "option_gameid": "0", - "option_game_speed": 60, "option_mips_for_3d_textures": false, - "option_draw_colour": 4294967295, - "option_window_colour": 255, - "option_steam_app_id": "0", "option_sci_usesci": false, - "option_author": "", - "option_collision_compatibility": true, - "option_copy_on_write_enabled": true, "option_spine_licence": false, - "option_template_image": "${base_options_dir}/main/template_image.png", - "option_template_icon": "${base_options_dir}/main/template_icon.png", + "option_steam_app_id": "0", "option_template_description": null, - "resourceVersion": "1.4", - "name": "Main", - "tags": [], - "resourceType": "GMMainOptions", + "option_template_icon": "${base_options_dir}/main/template_icon.png", + "option_template_image": "${base_options_dir}/main/template_image.png", + "option_window_colour": 255, } \ No newline at end of file diff --git a/options/operagx/options_operagx.yy b/options/operagx/options_operagx.yy index 8d52513..9d6b5a0 100644 --- a/options/operagx/options_operagx.yy +++ b/options/operagx/options_operagx.yy @@ -1,11 +1,27 @@ { - "option_operagx_version": "1.0.0.0", + "resourceType": "GMOperaGXOptions", + "resourceVersion": "1.1", + "name": "operagx", + "option_operagx_display_cursor": true, + "option_operagx_editUrl": "", "option_operagx_game_name": "${project_name}", + "option_operagx_guid": "", + "option_operagx_internalShareUrl": "", "option_operagx_interpolate_pixels": true, + "option_operagx_mod_editUrl": "", + "option_operagx_mod_game_name": "${project_name}", + "option_operagx_mod_guid": "", + "option_operagx_mod_internalShareUrl": "", + "option_operagx_mod_next_version": "1.0.0.0", + "option_operagx_mod_publicShareUrl": "", + "option_operagx_mod_team_id": "", + "option_operagx_mod_team_name": "", + "option_operagx_mod_version": "1.0.0.0", + "option_operagx_next_version": "1.0.0.0", + "option_operagx_publicShareUrl": "", "option_operagx_scale": 0, + "option_operagx_team_id": "", + "option_operagx_team_name": "", "option_operagx_texture_page": "2048x2048", - "resourceVersion": "1.0", - "name": "operagx", - "tags": [], - "resourceType": "GMOperaGXOptions", + "option_operagx_version": "1.0.0.0", } \ No newline at end of file diff --git a/options/windows/options_windows.yy b/options/windows/options_windows.yy index 4c83a2b..bcfccd9 100644 --- a/options/windows/options_windows.yy +++ b/options/windows/options_windows.yy @@ -1,36 +1,34 @@ { - "option_windows_display_name": "Created with GameMaker Studio 2", - "option_windows_executable_name": "${project_name}.exe", - "option_windows_version": "1.0.0.0", + "resourceType": "GMWindowsOptions", + "resourceVersion": "1.1", + "name": "Windows", + "option_windows_allow_fullscreen_switching": false, + "option_windows_borderless": false, "option_windows_company_info": "YoYo Games Ltd", - "option_windows_product_info": "Created with GameMaker Studio 2", + "option_windows_copy_exe_to_dest": false, "option_windows_copyright_info": "", "option_windows_description_info": "A GameMaker Studio 2 Game", + "option_windows_disable_sandbox": true, "option_windows_display_cursor": true, + "option_windows_display_name": "Created with GameMaker Studio 2", + "option_windows_enable_steam": false, + "option_windows_executable_name": "${project_name}.exe", "option_windows_icon": "${base_options_dir}/windows/icons/icon.ico", - "option_windows_save_location": 0, - "option_windows_splash_screen": "${base_options_dir}/windows/splash/splash.png", - "option_windows_use_splash": false, - "option_windows_start_fullscreen": false, - "option_windows_allow_fullscreen_switching": false, - "option_windows_interpolate_pixels": false, - "option_windows_vsync": false, - "option_windows_resize_window": false, - "option_windows_borderless": false, - "option_windows_scale": 0, - "option_windows_copy_exe_to_dest": false, - "option_windows_sleep_margin": 10, - "option_windows_texture_page": "2048x2048", "option_windows_installer_finished": "${base_options_dir}/windows/installer/finished.bmp", "option_windows_installer_header": "${base_options_dir}/windows/installer/header.bmp", + "option_windows_interpolate_pixels": false, "option_windows_license": "${base_options_dir}/windows/installer/license.txt", "option_windows_nsis_file": "${base_options_dir}/windows/installer/nsis_script.nsi", - "option_windows_enable_steam": false, - "option_windows_disable_sandbox": true, + "option_windows_product_info": "Created with GameMaker Studio 2", + "option_windows_resize_window": false, + "option_windows_save_location": 0, + "option_windows_scale": 0, + "option_windows_sleep_margin": 10, + "option_windows_splash_screen": "${base_options_dir}/windows/splash/splash.png", + "option_windows_start_fullscreen": false, "option_windows_steam_use_alternative_launcher": false, - "option_windows_use_x64": false, - "resourceVersion": "1.1", - "name": "Windows", - "tags": [], - "resourceType": "GMWindowsOptions", + "option_windows_texture_page": "2048x2048", + "option_windows_use_splash": false, + "option_windows_version": "1.0.0.0", + "option_windows_vsync": false, } \ No newline at end of file diff --git a/rooms/rm_test/rm_test.yy b/rooms/rm_test/rm_test.yy index c264f3e..b4dab18 100644 --- a/rooms/rm_test/rm_test.yy +++ b/rooms/rm_test/rm_test.yy @@ -1,43 +1,26 @@ { - "isDnd": false, - "volume": 1.0, - "parentRoom": null, - "views": [ - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, - ], - "layers": [ - {"instances":[ - {"properties":[],"isDnd":false,"objectId":{"name":"obj_disarm_example","path":"objects/obj_disarm_example/obj_disarm_example.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":256.0,"y":352.0,"resourceVersion":"1.0","name":"inst_4245A54C","tags":[],"resourceType":"GMRInstance",}, - ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",}, - {"spriteId":null,"colour":4279834905,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",}, - ], - "inheritLayers": false, + "resourceType": "GMRoom", + "resourceVersion": "1.0", + "name": "rm_test", "creationCodeFile": "${project_dir}/rooms/rm_test/RoomCreationCode.gml", "inheritCode": false, + "inheritCreationOrder": false, + "inheritLayers": false, "instanceCreationOrder": [ {"name":"inst_4245A54C","path":"rooms/rm_test/rm_test.yy",}, ], - "inheritCreationOrder": false, - "sequenceId": null, - "roomSettings": { - "inheritRoomSettings": false, - "Width": 500, - "Height": 500, - "persistent": false, - }, - "viewSettings": { - "inheritViewSettings": false, - "enableViews": false, - "clearViewBackground": false, - "clearDisplayBuffer": true, + "isDnd": false, + "layers": [ + {"resourceType":"GMRInstanceLayer","resourceVersion":"1.0","name":"Instances","depth":0,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"instances":[ + {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_4245A54C","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"objectId":{"name":"obj_disarm_example","path":"objects/obj_disarm_example/obj_disarm_example.yy",},"properties":[],"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":256.0,"y":352.0,}, + ],"layers":[],"properties":[],"userdefinedDepth":false,"visible":true,}, + {"resourceType":"GMRBackgroundLayer","resourceVersion":"1.0","name":"Background","animationFPS":15.0,"animationSpeedType":0,"colour":4279834905,"depth":100,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"hspeed":0.0,"htiled":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"properties":[],"spriteId":null,"stretch":false,"userdefinedAnimFPS":false,"userdefinedDepth":false,"visible":true,"vspeed":0.0,"vtiled":false,"x":0,"y":0,}, + ], + "parent": { + "name": "disarm", + "path": "disarm.yyp", }, + "parentRoom": null, "physicsSettings": { "inheritPhysicsSettings": false, "PhysicsWorld": false, @@ -45,12 +28,28 @@ "PhysicsWorldGravityY": 10.0, "PhysicsWorldPixToMetres": 0.1, }, - "parent": { - "name": "disarm", - "path": "disarm.yyp", + "roomSettings": { + "Height": 500, + "inheritRoomSettings": false, + "persistent": false, + "Width": 500, }, - "resourceVersion": "1.0", - "name": "rm_test", - "tags": [], - "resourceType": "GMRoom", + "sequenceId": null, + "views": [ + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + ], + "viewSettings": { + "clearDisplayBuffer": true, + "clearViewBackground": false, + "enableViews": false, + "inheritViewSettings": false, + }, + "volume": 1.0, } \ No newline at end of file diff --git a/scripts/scr_disarm/scr_disarm.gml b/scripts/scr_disarm/scr_disarm.gml index 282128c..51e1c92 100644 --- a/scripts/scr_disarm/scr_disarm.gml +++ b/scripts/scr_disarm/scr_disarm.gml @@ -22,7 +22,7 @@ function disarm_import_custom(_events) { static aux_image = function(_x) { if (is_string(_x)) { if (asset_get_type(_x) == asset_sprite) { - return __disarm_make_sprite_information(_x); + return __disarm_make_sprite_information(asset_get_index(_x)); } else if (file_exists(_x)) { var new_spr = sprite_add(_x, 1, false, false, 0, 0); return __disarm_make_sprite_information_managed(new_spr); @@ -318,6 +318,7 @@ function disarm_animation_begin(_arm) { slot.active = false; switch (slot.type) { case "bone": + case "box": slot.invalidWorldTransform = true; slot.posX = 0; slot.posY = 0; @@ -484,6 +485,57 @@ function disarm_animation_add(_arm, _anim, _progress, _amount=undefined) { slot.pivotY = pivot_y; slot.alpha = alpha; break; + case "box": + // get interpolation + var pos_x = key.posX; + var pos_y = key.posY; + var angle = key.angle; + var scale_x = key.scaleX; + var scale_y = key.scaleY; + var pivot_use_default = key.useDefaultPivot; + var pivot_x = key.pivotX; + var pivot_y = key.pivotY; + var alpha = key.alpha; + if (key_next != undefined) { + var linear = __disarm_animation_calculate_animation_interpolation_between_keyframes( + time, key.time, key_next.time, looping, time_duration); + var interp = __disarm_animation_calculate_curve_interpolation( + curve_type, linear, control_quad, control_cube); + pos_x = lerp(pos_x, key_next.posX, interp); + pos_y = lerp(pos_y, key_next.posY, interp); + angle = __disarm_animation_lerp_angle(angle, key_next.angle, key.spin, interp); + scale_x = lerp(scale_x, key_next.scaleX, interp); + scale_y = lerp(scale_y, key_next.scaleY, interp); + //if not (pivot_use_default) { // wtf, not actually needed?! + // pivot_x = lerp(pivot_x, key_next.pivotX, interp); + // pivot_y = lerp(pivot_y, key_next.pivotY, interp); + //} + alpha = lerp(alpha, key_next.alpha, interp); + } + // blend between current and new animation + if (_amount != undefined) { + pos_x = lerp(slot.posX, pos_x, _amount); + pos_y = lerp(slot.posY, pos_y, _amount); + angle = __disarm_animation_lerp_angle(slot.angle, angle, 1, _amount); + scale_x = lerp(slot.scaleX, scale_x, _amount); + scale_y = lerp(slot.scaleY, scale_y, _amount); + //if not (pivot_use_default) { // wtf + // pivot_x = lerp(slot.pivotX, pivot_x, _amount); + // pivot_y = lerp(slot.pivotY, pivot_y, _amount); + //} + alpha = lerp(slot.alpha, alpha, _amount); + } + // apply transformations + slot.posX = pos_x; + slot.posY = pos_y; + slot.angle = angle; + slot.scaleX = scale_x; + slot.scaleY = scale_y; + slot.useDefaultPivot = pivot_use_default; + slot.pivotX = pivot_x; + slot.pivotY = pivot_y; + slot.alpha = alpha; + break; case "point": // get interpolation var pos_x = key.posX; @@ -530,6 +582,12 @@ function disarm_animation_add(_arm, _anim, _progress, _amount=undefined) { var bone_ref_parent = bone_refs[idx_slot_ref_parent]; slot.boneParent = timelines[bone_ref_parent.timeline].slot; } + if (timeline.slot != -1) { + slot.obj = info[timeline.slot]; + slot.obj.active = true; // enables the object visibility + } else { + slot.obj = undefined; + } } } @@ -605,6 +663,51 @@ function disarm_animation_end(_arm, _skin_data=undefined) { slot.idxAtlas = folder.atlas; slot.frameName = file.name; break; + case "box": + var box = slot.obj; + box.posX = slot.posX; // HACKY + box.posY = slot.posY; + box.angle = slot.angle; + box.scaleX = slot.scaleX; + box.scaleY = slot.scaleY; + box.alpha = slot.alpha; + box.boneParent = slot.boneParent; + __disarm_update_world_transform(box, bone_parent); + var pivot_x, pivot_y; + if (slot.useDefaultPivot) { + pivot_x = file.pivotX; + pivot_y = file.pivotY; + } else { + pivot_x = slot.pivotX; + pivot_y = slot.pivotY; + } + pivot_y = 1 - pivot_y; // why would you do this to me + var source_left = -pivot_x * box.width; + var source_top = -pivot_y * box.height; + var source_right = source_left + box.width; + var source_bottom = source_top + box.height; + var left = source_left; + var top = source_top; + var right = source_right; + var bottom = source_bottom; + var slot_x = box.posX; + var slot_y = box.posY; + var slot_scale_x = box.scaleX; + var slot_scale_y = box.scaleY; + var slot_dir = box.angle; + var i_x = lengthdir_x(slot_scale_x, slot_dir); + var i_y = lengthdir_y(slot_scale_x, slot_dir); + var j_x = lengthdir_x(slot_scale_y, slot_dir - 90); + var j_y = lengthdir_y(slot_scale_y, slot_dir - 90); + box.aX = slot_x + left * i_x + top * j_x; + box.aY = slot_y + left * i_y + top * j_y; + box.bX = slot_x + right * i_x + top * j_x; + box.bY = slot_y + right * i_y + top * j_y; + box.cX = slot_x + right * i_x + bottom * j_x; + box.cY = slot_y + right * i_y + bottom * j_y; + box.dX = slot_x + left * i_x + bottom * j_x; + box.dY = slot_y + left * i_y + bottom * j_y; + break; case "point": __disarm_update_world_transform(slot, bone_parent); break; @@ -658,6 +761,28 @@ function disarm_draw_debug(_arm, _offset_x=0, _offset_y=0, _scale_x=1, _scale_y= draw_ellipse(x1 - _scale_x * wid, y1 - _scale_y * wid, x1 + _scale_x * wid, y1 + _scale_y * wid, true); break; + case "box": + var alpha = 1; + var col = c_purple; + var x1 = _offset_x + _scale_x * slot.aX; + var y1 = _offset_y + _scale_y * slot.aY; + var x2 = _offset_x + _scale_x * slot.bX; + var y2 = _offset_y + _scale_y * slot.bY; + var x3 = _offset_x + _scale_x * slot.cX; + var y3 = _offset_y + _scale_y * slot.cY; + var x4 = _offset_x + _scale_x * slot.dX; + var y4 = _offset_y + _scale_y * slot.dY; + var x5 = _offset_x + _scale_x * slot.posX; + var y5 = _offset_y + _scale_y * slot.posY; + draw_primitive_begin(pr_linestrip); + draw_vertex_colour(x1, y1, col, alpha); + draw_vertex_colour(x2, y2, col, alpha); + draw_vertex_colour(x3, y3, col, alpha); + draw_vertex_colour(x4, y4, col, alpha); + draw_vertex_colour(x1, y1, col, alpha); + draw_vertex_colour(x5, y5, c_fuchsia, alpha); + draw_primitive_end(); + break; } } for (var i = entity.slotCount - 1; i >= 0; i -= 1) { @@ -1153,6 +1278,7 @@ function __disarm_import_entity_object(_struct) { var f = undefined; switch (type) { case "bone": f = __disarm_import_entity_object_bone; break; + case "box": f = __disarm_import_entity_object_box; break; } var slot = f == undefined ? { } : f(_struct); slot.name = __disarm_struct_get_string_or_default(_struct, "name"); @@ -1178,6 +1304,25 @@ function __disarm_import_entity_object_bone(_struct) { }; } +/// @desc Creates a new Disarm box object. +/// @param {struct} struct A struct containing the Spriter project information. +function __disarm_import_entity_object_box(_struct) { + return { + width : __disarm_struct_get_numeric_or_default(_struct, "w", 1), + height : __disarm_struct_get_numeric_or_default(_struct, "h", 1), + posX : 0, + posY : 0, + angle : 0, + scaleX : 1, + scaleY : 1, + defaultPivotX : __disarm_struct_get_numeric_or_default(_struct, "pivot_x"), + defaultPivotY : __disarm_struct_get_numeric_or_default(_struct, "pivot_y", 1), + alpha : 1, + boneParent : -1, + invalidWorldTransform : true, + }; +} + /// @desc Creates a new Disarm character map. /// @param {struct} struct A struct containing the Spriter project information. function __disarm_import_entity_character_map(_struct) { @@ -1259,6 +1404,7 @@ function __disarm_import_entity_animation_timeline(_struct) { case "bone": f = __disarm_import_entity_animation_timeline_keyframe_bone; break; case "sprite": f = __disarm_import_entity_animation_timeline_keyframe_sprite; break; case "point": f = __disarm_import_entity_animation_timeline_keyframe_point; break; + case "box": f = __disarm_import_entity_animation_timeline_keyframe_box; break; } return { name : __disarm_struct_get_string_or_default(_struct, "name"), @@ -1324,6 +1470,23 @@ function __disarm_import_entity_animation_timeline_keyframe_point(_struct) { return key; } +/// @desc Creates a new box keyframe for a Disarm animation. +/// @param {struct} struct A struct containing the Spriter project information. +function __disarm_import_entity_animation_timeline_keyframe_box(_struct) { + var key = __disarm_import_entity_animation_timeline_keyframe(_struct); + var slot = __disarm_struct_get_struct(_struct, "object"); + key.posX = __disarm_struct_get_numeric_or_default(slot, "x"); + key.posY = -__disarm_struct_get_numeric_or_default(slot, "y"); + key.angle = __disarm_struct_get_numeric_or_default(slot, "angle"); + key.scaleX = __disarm_struct_get_numeric_or_default(slot, "scale_x", 1); + key.scaleY = __disarm_struct_get_numeric_or_default(slot, "scale_y", 1); + key.useDefaultPivot = !variable_struct_exists(slot, "pivot_x") && !variable_struct_exists(slot, "pivot_y"); + key.pivotX = __disarm_struct_get_numeric_or_default(slot, "pivot_x"); + key.pivotY = __disarm_struct_get_numeric_or_default(slot, "pivot_y", 1); + key.alpha = __disarm_struct_get_numeric_or_default(slot, "a", 1); + return key; +} + /// @desc Returns the slot with this name, or creates a new slot if it doesn't exist. /// @param {string} name The name of the slot. /// @param {string} type The type of slot. @@ -1347,6 +1510,7 @@ function __disarm_animation_get_slot_by_name_or_spawn_new(_name, _type, _slot_ta var slot = slot_data[1]; slot.folder = -1; slot.file = -1; + slot.obj = undefined; slot.posX = 0; slot.posY = 0; slot.angle = 0; @@ -1478,20 +1642,17 @@ function __disarm_update_world_transform(_child, _bone_parent) { /// @param {real} id The object index. function __disarm_update_world_transform_using_object_array(_info, _idx) { var slot = _info[_idx]; - switch (slot.type) { - case "bone": - if (slot.invalidWorldTransform && slot.active) { - slot.invalidWorldTransform = false; - switch (slot.type) { - case "bone": - var idx_parent = slot.boneParent; - var bone_parent = idx_parent == -1 ? undefined : - __disarm_update_world_transform_using_object_array(_info, idx_parent); - __disarm_update_world_transform(slot, bone_parent); - break; - } + + if (slot.invalidWorldTransform && slot.active) { + slot.invalidWorldTransform = false; + switch (slot.type) { + case "bone": + var idx_parent = slot.boneParent; + var bone_parent = idx_parent == -1 ? undefined : + __disarm_update_world_transform_using_object_array(_info, idx_parent); + __disarm_update_world_transform(slot, bone_parent); + break; } - break; } return slot; } diff --git a/scripts/scr_disarm/scr_disarm.yy b/scripts/scr_disarm/scr_disarm.yy index 3d90a98..b0af3b8 100644 --- a/scripts/scr_disarm/scr_disarm.yy +++ b/scripts/scr_disarm/scr_disarm.yy @@ -1,12 +1,11 @@ { - "isDnD": false, + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "scr_disarm", "isCompatibility": false, + "isDnD": false, "parent": { "name": "Disarm", "path": "folders/Disarm.yy", }, - "resourceVersion": "1.0", - "name": "scr_disarm", - "tags": [], - "resourceType": "GMScript", } \ No newline at end of file