u/EnricosUt

Getting a Function from JSON

I have made a JSON file that stores all the dialogue in my game. It is pretty sweet for storing text, but issues arise when I try including variables and functions in my text.

Let's say I have a character that is saying:
"You are x feet away."

With concatenation, this is trivial: I can do
"You are " + distance_to_object(obj) + "feet away."

But how should I do this with JSON? JSON doesn't know what distance_to_object() is, nor does it know what "obj" is

Passing in a string or number isn't too hard, I can just make an arguments variable in my JSON parser.

{
    "textvalue": "this should be 100: [0]",
    "arg": "100"
}

But that only works with static values and not something that can change dynamically in the game.

Any suggestions?

reddit.com
u/EnricosUt — 7 days ago
▲ 138 r/gamemaker

Pixel-perfect Parallax

My game has a pixel-perfect camera, it is drawing on a surface that is my pixel resolution that is scaled up. I have parallax backgrounds in my game but when it is also pixel perfect, it leads to jittery movement (look at the stars) as it is moving too subtlety for the pixel grid to account for. Does anyone have any experience with making this look better?

u/EnricosUt — 2 months ago

Edges of screen with ripple effect

When using the ripples layer effect, it stretches the layer sprite on the sides of the screen (look on the right side of the background in the gif). How do I avoid this?

u/EnricosUt — 4 months ago

Particles with Really Fast Animation

I am making a particle system for an explosion and the animation is playing way faster than it should.

I toggled the animation stretch on and off, if stretch is on it plays too slow and if stretch is turned off it plays at a faster speed than it should.

How do I make it play at the speed that it runs at in the sprite editor?

https://i.redd.it/ycgonsa1fz1h1.gif

//psExplosion
ps = part_system_create();
part_system_draw_order(ps, true);

//Emitter
var _ptype1 = part_type_create();
part_type_sprite(_ptype1, sExplosion, true, false, true);
part_type_size(_ptype1, 0.8, 1.2, 0, 0);
part_type_scale(_ptype1, 1, 1);
part_type_speed(_ptype1, 0.01, 0.1, 0, 0);
part_type_direction(_ptype1, 0, 360, 0, 5);
part_type_gravity(_ptype1, 0.001, 270);
part_type_orientation(_ptype1, 0, 0, 0, 0, false);
part_type_colour3(_ptype1, $FFFFFF, $FFFFFF, $FFFFFF);
part_type_alpha3(_ptype1, 1, 1, 1);
part_type_blend(_ptype1, false);
part_type_life(_ptype1, length - 10, length + 10);

var _pemit1 = part_emitter_create(ps);
part_emitter_region(ps, _pemit1, -d, d, -d, d, ps_shape_ellipse, ps_distr_linear);
part_emitter_burst(ps, _pemit1, _ptype1, intensity);

part_system_position(ps, x, y);
reddit.com
u/EnricosUt — 5 months ago