处理:我如何为每个“x”创建一个对象时间 [英] Processing: How do i create an object every "x" time

查看:110
本文介绍了处理:我如何为每个“x”创建一个对象时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用delay();但我失败了。

What I want to do is to create a new planet in my system for example every 10 seconds and that it starts to move and also prints a "hello" . At the end I want that the 8 planets (ellipses) will be moving together.

有人可以帮我吗?

I try to use delay(); but I failed .

Can someone help me please?


modulo%运算符

>以及 draw() frameCount 变量

下面是一个示例程序,它画出大多数框架的小圆圈,但每60帧绘制一个大圆圈:

Here is an example program that draws little circles most frames, but draws a big circle every 60 frames:

void setup() {
  size(500, 500);
  background(0);
}

void draw() {

  ellipse(mouseX, mouseY, 10, 10);

  if (frameCount % 60 == 0) {
    ellipse(mouseX, mouseY, 50, 50);
  }
}

这篇关于处理:我如何为每个“x”创建一个对象时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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