如何在GML中倒水? [英] How to make water pour in GML?

查看:90
本文介绍了如何在GML中倒水?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从游戏机中具有obj_flaskobj_waterobj_container的烧瓶中倒水. 我想将obj_waterobj_flask倒入obj_container.

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.

推荐答案

这在很大程度上取决于您要如何实现此效果.例如,您可以使动画精灵从烧瓶延伸到容器.或者,您可以以给定的时间速率创建水滴实例,并使它们受到重力的影响.或者,您可以使用粒子系统,但是如果要检查它是否真的撞击容器,通常会给您较少的控制.

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.

这篇关于如何在GML中倒水?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆