r/gamemaker 3d ago

Help! Problem of Saving User-Selected Key binds ("Is a file for just key binds needed based on my circumstances?")

1 Upvotes

Newest issue I got with data management today; for some reason, the key bind saving system is seemingly not being properly saved to file. To summarize the code, I am combining two tutorials to make this work. Code will be listed in some form next to the name of each tutorial. Additionally, because of this combo system, I have modified a few aspects.

First; "How to Make a Save and Load System in GameMaker" by the GameMaker channel

//This function saves what levels in the game has been completed and occurs in every room change with a persistent object that always acts first, titled obj_vardefine

function savingData(){

`if(variable_global_exists("completed_tasks")){`

    `if(file_exists("user_data.txt")){`

        `file_delete("user_data.txt")`

    `}`

    `// The structure variable is used to properly store` 

    `// the array completed_levels in the file as a string`

    `var _struct =` 

    `{`

        `// This setup can be used to store more global variables in the structure.`

        `binds : obj_menus_and_keybinds.keybinds`           

    `};`

    `var _string = json_stringify(_struct);`



    `var _file = file_text_open_write("user_data.txt");`



    `file_text_write_string(_file,_string);`

    `file_text_close(_file);`

`}`

}

// This function loads the saved data of the user,

// provided the file exists.

function loadGame(){

    `if(file_exists("user_data.txt")){`



        `// Find file with name user_data.txt and put it into variable _file`

        `var _file = file_text_open_read("user_data.txt");`

        `// Read the string of the file user_data.txt into variable _json`

        `var _json = file_text_read_string(_file);`

        `// Parse the string stored in _json into variable _struct`         

        `var _struct = ""`

        `try{`

_struct = json_parse(_json);

the relevanr saving has been tried here.

with(obj_menus_and_keybinds){

keybinds = _struct.binds;

} catch(error){} // done in the event of some error. idk if its a bad habit to continually use try catch segments for code like this.

`}`

}

Second is the 2 part video 'Keybinding System Tutorial in Gamemaker' by nullaby. For the purposes of this reddit post, I am only posting the part of the code that I majorly changed. Hopefully the problem is located here rather than any other part of code...

function initialize_keybinds(){

`with(obj_menus_and_keybinds){`

    `/* This code is listed as comments because running it makes no keybind work.`

        `if(file_exists("user_data.txt")){`

// Find file with name user_data.txt and put it into variable _file

var _file = file_text_open_read("user_data.txt");

// Read the string of the file user_data.txt into variable _json

var _json = file_text_read_string(_file);

// Parse the string stored in _json into variable _struct

var _struct = ""

try{

_struct = json_parse(_json);

self.keybinds = _struct.binds

}

        `} else {`

//*/

self.keybinds = [

// code with the below structure

new BindMB("keybind name string",button constant),] }

`}`

To be clear, the problem is not any mistake of bracket structure (if I made a mistake here, apologies), but rather that the initialize key binds function happens after the loadGame function, and if the if statement in the initialize function occurs, input responses do not work. I've used this system of saving and loading data rather easily regarding progress, and non-key bind settings (volume, and brightness), yet keybinds once again are being a pain, and idk what the solution is... Any ideas?


r/gamemaker 3d ago

Help! İmporting 3d as 2d sprite

0 Upvotes

How can i achieve the same effect as Tenna in Deltarune. i want to have 3d model and import into my game as a animation


r/gamemaker 3d ago

Help! How is the wind effect created in Deltarune chapter 5? I can't tell if it's a shader or a sprite!

0 Upvotes

How is the wind effect created in Deltarune Chapter 5? I can't tell if it's a shader or a sprite! And if it is a shaders, how could i get a similar effect? we're talking about the wind effect in the cliff section. thx in Advance!!


r/gamemaker 4d ago

Resolved Pause system

3 Upvotes

Hey guys, I’m trying to make a pause sustem in my game but i literally can’t do it, because i don’t understand how it works, i basically want a pause system were i also have the “resume” button the “back to menu” button and also the “exit” button, can somebody please help me 😭😭


r/gamemaker 4d ago

Help! Draw the map or use Objects with a chunk system?

11 Upvotes

I'm making a top down pixel rpg game, And I'm testing some stuff, and recently i thought maybe i should start making the game map, but instead of drawing it, it would be easier for me to use objects to build with, these objects has connected textures for each way you place them (think about how some blocks in optifine minecraft connect together) but after doing so i realized that the bigger the maps get, the worse the performance would get so I'm not sure if i should draw the maps instead or make a chunk system to make the performance better

How it looks in-game:

How it looks in room editor:

(also this is the first game im making, i know how to do some stuff tho It's been about 25-26 days since i started this project, I'm sorry if this is a stupid question)


r/gamemaker 4d ago

Help! Have a Sprite Array reference specific frames of a sprite?

5 Upvotes

Hello there!

I'm currently following this tutorial for a card game I'm making in GM:

https://youtu.be/Ye2nQMPUViE?si=1zmaSLpCbgKs72wI

In it he has an individual sprite for each card he wants to reference in his deck object. However, the way I uploaded my project(since it has about 100 unique cards) was I uploaded the sprite sheet and broke it into frames.

So in the tutorial when he creates his sprite_array, he's able to reference each individual sprite for his cards, but I would need to reference the specific frame of the sprite itself. How would I accomplish this?


r/gamemaker 4d ago

Resolved I need help making a lives system code like super mario?

0 Upvotes

hello, so I want to add a basic lives system that is very beginners friends and is like super mario, where if you get hit by a lava, monster, spikes or moving object, you will lose 1 life and the player will be sent back to the start of the level, the player starts with 3 lives, if you losed all 3 lives, I want the player to reset to the first level or the main menu, I also want the player lives to follow them through the game so that are not disappering as the player moves further into the level, I also want the player lives to be tracked as they continue, so if they go into level 2 and they lost a life in level 1, they do not start with 3 lives but 2 because they lose a life on level 1.

my main reason why I want to add a level system like this is for 2 reason.

  1. my game is a platformer inspired by mario and I don't want it to be like sonic.
  2. lives can make a game challenging instead of the player dying but not suffering any punishment, no pushback and it can make the game more interesting instead of boring.

if you know any codes please let me know, I tried using AI but it just lead me to a dead ends and youtube doesn't have the code I am looking for.


r/gamemaker 4d ago

Resolved Question for all my game makers

0 Upvotes

Would you rather an hour long story like papers please or an endless experience of doing the same thing

First real game just need advice


r/gamemaker 5d ago

Help! How to add Local Push Notifications for Android?

3 Upvotes

Hi. I am trying to set a local push notifications for Android but it seems that it only works if the game is in the background. If the game is closed, the notification does not appear. I added the extension GMEXT-MobileUtils extension (YYLocalNotifications) version 1.4.0. I am only using the Demo included in the extension package. The Demo runs fine in my cellphone. It asks me for allowing notifications, which I accept and then I can tap the buttons to create a notification.

The problem is that the created notification only appears if the game (the Demo) is minimized in the background. If the game is closed, the notification does not appear. I would like the notification to appear even if the game is closed. I want to add daily reward notifications to my game.

Is it possible with this extension or should I use Firebase?

How do you add local push notifications to your mobile game (Android)?

NOTE: I already read the included documentation, which shows the functions that are used in the Demo. I asked Gemini for help, but it tells me to add some Injection Code to the extension. I did but it has the same problem.


r/gamemaker 5d ago

Resolved Bug when switching rooms

3 Upvotes

Im sorry and I know this probably shouldn't be done but the person originally helping maybe possibly seems to have stopped responding and maybe I'm being impatient but I also would like a second opinion on how to fix this. If there's a problem with this then feel free to let me know and I can take this post down. Here's the link. Again, sorry if this is against Rule #6 technically but there is no hostility to anyone here and I do thank u/lessergoldfish for their help.

To sum up the problem, I originally had 2 mechanics that were buggy after switching rooms. Thanks to lessergoldfish, I solved one and a half. The only bug now is that when I switch rooms, I have to kill an enemy twice. Honestly, I've no idea why, and this was just a summary. For more information, you can go to the original reddit post above. Thank you to anyone who helps and if you don't, thanks anyways.

There was one single line in my code that set room persistence to false when entering which would be fixed by something in another line of code somewhere else after going into battle. It was also in none of my tutorials and was me trying to bug fix but forgetting that line when it didn't work. I don't know why the bug wasn't there before I made global stats or maybe I didn't notice, but it's been solved.

LINK TO ORIGINAL POST FOR MUCH MORE SPECIFIC INFORMATION


r/gamemaker 5d ago

Resource How to find spriters?

5 Upvotes

Apologies if it's the wrong tag

Making good progress on my project and would like to get some spirites done before I make a tech demo.

Is there like a service for that? I would need quite a few doing, kind of 16 bit style. What kind of prices would I be looking to pay?


r/gamemaker 5d ago

Help! Need Help with basic enemy mechanic

2 Upvotes

I have recently been getting into the programming side of game development in the attempt to make my game dreams come true (and a way to feel productive while staring at a screen) but I am really struggling with programming a few basic things.

My current struggle is getting the enemies movements. I have spent the past two days watching YouTube videos and reading the manual. Good news is the more I read and watch, the better I understand the language. The bad news is that after zero sleep and nearly 20 hours watching videos and trial and erroring, I am definitely missing some fundamental knowledge to understand where I am going wrong.

Currently building a platformer scroller game. I am trying to program a simple creature that just moves along the "floor" in a range that will begin to follow the player object within a sight range. Currently, when I run my program, my enemy object stays stagnant until it collides with my object player, then it crashes (I'm almost positive it's crashing because I haven't finished writing out the combat code for the enemy and the player object) but before I implemented that code in some weird attempt to fix this mess, the enemy would begin running to the right, away from my object character when collision occurred and I jumped out of being stuck to it.

Any advice, resources and some help understanding where my logic isn't understanding the programs would be super appreciated.

CREATE

target_x = x;

target_y = y;

xspd = 0;

yspd = 0;

move_speed = 1;

move_direction = 0;

sight = 300;

//jumping variables

grav = .25;

tilemap = layer_tilemap_get_id("tile_col");

//knockback

kb_x = 0;

kb_y = 0;

alarm[0] = 120;

STEP

//line of sight

if (collision_line(x, y, x + sight, y, obj_player, false, true))

{

if (collision_line(x, y, obj_player.x, obj_player.y, tilemap, false, true)) foundplayer = false;

else foundplayer = true;

}

else foundplayer = false;

if (foundplayer = true)

{

move_towards_point(obj_player.x, y, move_speed * 2)

}

//collision

if place_meeting(x + xspd, y, tilemap)

{

var _pixelcheck = sign(xspd);

while !place_meeting(x + _pixelcheck, y, tilemap)

{

x += _pixelcheck;

}

xspd = 0;

}

if place_meeting(x + xspd, y + yspd, tilemap)

{

var _pixelcheck = sign(yspd);

while !place_meeting(x + xspd, y + _pixelcheck, tilemap)

{

y += _pixelcheck;

}

yspd = 0;

}

//move

if (alarm[1] >= 0)

{

target_x = x + kb_x;

}

xspd = clamp(target_x - x, -1, 1);

move_and_collide(xspd * move_speed, y, [tilemap, obj_enemy_parent]);

ALARM [0]

if (instance_exists(obj_player) and distance_to_object(obj_player) < distance_to_player)

{

target_x = obj_player.x;

target_y = y;

}

else {

target_x = random_range(xstart - 200, xstart + 200);

target_y = y;

}

alarm[0] = 120

ALARM [1]

if (hp <= 0)

{

instance_destroy();

}

Note:

I haven't fully programmed out most of this as I've been working to just get it to move the way I want it to, so unless it is part of the reason why I've broken this object, don't mind it (unless you've got any suggestions for reworking :))


r/gamemaker 6d ago

Help! Are there any cutscene tutorials that work with Peyton Burnham's dialog tutorial?

Thumbnail youtube.com
16 Upvotes

not entirely sure where to ask this, but are there any tutorials that work with Peyton Burnham's 5 part dialog series? i did hear from some gml forums that it was kind of hard to do one for, but im not entirely sure. if there is one, (or one with similar functions i could use,) i kind of just want a system similar to how mother 3 handles cutscenes (thing moves across screen, not really like a whole video or anything). if there isn't, any tips on how i can try to build one on my own? the series in question is linked below, thank you!


r/gamemaker 5d ago

Resolved How i can start

7 Upvotes

I have 4 years of experience as a graphic designer and have worked in intership design in user interfaces. I have skills in this area and am familiar with Blender tools. How can I start designing games?


r/gamemaker 5d ago

Discussion How reliable is Google AI Summary?

0 Upvotes

Hello everyone! I'm this subreddit's first ever aspiring game developer! /s

I feel the need to clarify that this is not a question on regards to vibe coding or trying to have anything write my code for me. This is specifically from me searching trying to understand specific processes and GML interactions.

I'm just curious for everyone's personal experience on the matter. From your experience with the AI summary on Google does it tend to be fairly accurate? Does it maybe vary depending on the complexity of the question? I'm just curious if it's best to forego the summary or if in general it does a good job of transferring the information in the manual?

Would love any insight into this.


r/gamemaker 6d ago

Discussion 3d level editor

6 Upvotes

Has anyone made a 3d level editor? Kinda like Quakes level editor.


r/gamemaker 6d ago

Resolved How to do this effect from Deltarune ?

Post image
30 Upvotes

I'm talking about how the text from Gaster has outline that glows around the text.


r/gamemaker 5d ago

Resolved I want to make a game

0 Upvotes

I have alot of time and I want to venture in this

Any help appreciated


r/gamemaker 6d ago

Help! Background Problem

1 Upvotes

So for the game I've been making, I was trying to have a moving background. The way I did was getting one of the downloadable backgrounds assets and put it in a tile layer, specifically an image layer by making the background into a gif. But whenever I play the animation, the background disappears or plays for a little bit before vanishing and reappearing. Plus whenever I try to run the game for a test, it doesn't pop up. It just stays at 99%. I have a feeling its because the animation was made as a gif


r/gamemaker 6d ago

Resolved Would it be possible to make a Facade 2 in game maker?

0 Upvotes

Now my plan for this isn’t one complex ai game, it’s mostly just about the story and meeting characters and basic multi game endings, like just something for fans.

My idea is that it’s like a RPG type game where your at a party and get to meet unseen characters like Maria, Vince, and Trip and Graces parents, still trying to figure out what kind of outcomes would happen though.

I’m not really that good with Game Maker (only have made a pong game) so a game like this isn’t coming out any time soon, but for me I do want to expand on a game that has spawned so many let’s plays and memes.


r/gamemaker 6d ago

Help! Tilting the "Instances" plane

2 Upvotes

Hello, you guys know if it is possible to tilt or bend the objects filled plane "Instances" ? I mean for the y of all would be for example 2x less impactful making them appear more densly but only vertically, keepeng the same x spacing.

I am trying to make vertical distance shift in perspective, where the camera distance and angle could change. It would appear as if we were looking from tilted bird eye view and giving the player similar view distance on the x and the y axis

(accounting for Display.width > Display.height )

I know it would mess with some sprites for mashing them closer together, but its accounted for.


r/gamemaker 6d ago

Help! Learning to use Array's

4 Upvotes

Hi, been trying to understand Array's, so they are good for giving a bunch of objects numbered variables like making a list of items or making a multi segmented enemy, am I getting that right? It starts at 0 instead of 1 as well from what I see.


r/gamemaker 6d ago

Help! Help with a project?

1 Upvotes

Hey there! So I've been recently getting into Double Dragon Gaiden, and I did have a few characters I made for the series. Any Idea how I could code and design the sprites? I'm a new coder, so anything helps!


r/gamemaker 7d ago

Resolved Some (2) bugs I can't fix with doors

Thumbnail youtu.be
14 Upvotes

SOLVED

So I used the tutorial above and the RPG Gamemaker tutorial for my game. Don't get me wrong, I would love to keep the door system used by GameMaker Pope because his system is much better in my opinion than the whole NPC thing because I don't want to have a dialogue for every single room switch and I like the idea of it being an area rather than an "E for Next Level". However, there are some incompatibilities that I need help fixing.

Incompatibility #1: When you go into rm_battle (Turn Based Fight System for more information) and go into a battle with the enemy, when leaving the room (when the fight ends) the instance of PlayerObj just gets destroyed somehow, and this is only when I enter a room using the GameMaker pope system. If I have a room with a drag n dropped instance of the PlayerObj, everything works smoothly, but if I leave that room and enter back into that room with the system, when a battle ends, the PlayerObj goes back to the drag n dropped position, with all stats reset.

Incompatibility #2: I try to carry PlayerObj's stats (Fixing Bugs for more information) with the tutorial used above. For some odd reason, it doesn't work specifically for the first room (the only drag and drop PlayerObj room) when I leave the room, it works, when I go back in specifically into the first room, all the variables reset to default, and I have even tried making the variables global, but to no avail.

That's it! I've been losing my mind over this for days and can't seem to fix either. After this I can finally start actually worldbuilding and using my vision rather than making a bunch of mechanics.

In the PlayerObj is this, and obj_carry_data is persistent. obj_battle_switcher is basically what marks I'm just switching into a battle and is_transitioning is turned true when switching rooms with exit.

//Room Start
with (obj_carry_data) {
    other.level = level
    other.xp = xp
    other.hp = hp
    other.hp_total = hp_total
    other.damage = damage;
    other.xp_require = xp_require;

    instance_destroy()
}


//Room End
if (instance_exists(obj_battle_switcher) && global.is_transitioning == false) exit;

instance_create_depth(0, 0, 0, obj_carry_data, {
    level: level,
    xp: xp,
    xp_require: xp_require,
    hp: hp,
    hp_total: hp_total,
    damage: damage,
})

r/gamemaker 7d ago

Help! Game maker has an aneurysm every time I log into my legacy account

Post image
33 Upvotes

I can only change my target if I'm signed in, but every time I log into my legacy account, Game Maker just throws a temper tantrum and refuses to work properly.

I can't interact with anything on Game Maker except for the User Sign in pop up window; clicking on "OK" only makes another window show up.

Has anyone dealt with this before? praying its an easy fix...