I made a small update tonight to deploy the new “save” behavior. It has one property, and two inputs.
The only property is “name”, and this is the location where the value is saved and read from.
The inputs are “save” and “read”. If you send a value into the “save” input, it will be saved to the players local storage. If you trigger the “read” input, the local value will be read from storage and sent to the output.
The value can only be read by the player that stored it, so two players cannot see each others saved values.
Use caution: saving and reading values is not very fast, so take care where you use it so that it does not add lag to your games.
Well, it’s “small” because it’s only a single thing that changed
ztg5 - it’s in “Game Flow”. Maybe that’s not the best section, but that’s where I put it for now.
To clarify - saving and reading are only slow in a relative sense, compared to most other behaviors. The way you could cause lag would be to maybe save or read values on every frame - if you just save and read values when you need them, it won’t have any adverse affects.
So i made a save console in hyper survival corruption, and its an object in the UI that transverses through levels. When clicked, it emits a sound and ‘saves’ and when the L button is pressed or the load button on the title screen is clicked, it doesnt want to work?
Ok, i found out how it works. You can give a name to a number, and in a different spot, you can use that same number. So you can make a calculator now… Sorta
jngthree - to save and restore the position (x and y properties) of an object you would do this:
connect a trigger to an extractor behavior, and extract the “x” property of your object. Send this to “save” input of a save behavior and name it “x”. Now do the same thing for the “y” property.
Now the position of your object will be stored whenever the trigger fires.
To restore the position on start, connect a once trigger to the “read” input of those save behaviors, then send those values into the x & y inputs of a “position” behavior.
Well, you can pretty easily save the current level and restart at that level, and save/restore the players score and health - is there something specific you wanted to save that can’t be?
It does stay!!!
I noted that in my game, because it counts your seconds, i made it to where it saves the score right after the score update, so it saves after the second passes, so it can show on the game over screen, and even then there are about 6 different save commands used and only two separate variables… It stayed at a solid 30 FPS. The high score thing isnt working unless you turn on the editor on and off… I dont exactly know why, but…
So, made a small game and used the save command.
It keeps track of your personal best, and the score from the previous game…
The game itself is harder than it looks, my high-score is 83
Can you top it??