问题
How can I make water pour from a flask in game maker where have obj_flask
, obj_water
, and obj_container
.
I want to make the obj_water
pour from obj_flask
into the obj_container
.
回答1:
This depends hugely on how you want to achieve this effect. You could for example have an animated sprite stretching from the flask to the container. Or you could create water droplet instances at a given time rate and let them be affected by gravity. Or you could use a particle system, but this usually gives you less control if you want to check if it actually hit the container.
I can show you how to make the second idea to get you started.
obj_jug
Step Event:
execute code:
x = mouse_x;
y = mouse_y;
if (mouse_check_button(mb_left))
{
instance_create(x + 32, y + 8, obj_droplet);
}
obj_droplet
Create Event:
execute code:
a = 1;
v = 0;
Step Event:
execute code:
v += a;
y += v;
if (y >= window_get_height())
{
instance_destroy();
}
Collision Event with object obj_container:
destroy the instance
This will not give a great effect, but it will do what is being asked.
来源:https://stackoverflow.com/questions/37067422/how-to-make-water-pour-in-gml