Finding the correct delay to spawn a 'moving platform'

Hi all,

Blender noob here hoping to get advice on two problems.

Here is a printscreen of a game I am created. It is a tunnel runner, except instead of a tunnel we have a moving platform (you can only move left and right): (attachment)

I done this by creating an empty object to spawn with, located at -220 on the X axis. Then with a script, I spawn a 11 planes (clones of an object with a texture on, that is simple a white square outlined with black) which has a width of 40, and each plane is 40 away from the next. These are then ‘fired’ at a speed of -180 toward the camera to give the affect.

The problem is with the delay sensor, that spawns… however many ‘tics’ per second. How can I make this so that it spawns them all in a uniform manner? I want a smooth platform with no gaps inbetween.

It is crucial I do it this way, as later on I will be adding effects to individual platforms.

The next problem is there seems to be flickering lines along the y axis, and I’m not so sure why (because platforms are being spawned on top of one another?).

Any help is much appreciated!

You’ll have to use a new delay sensor, to trigger a new spawn function at the right time, which will spawn the planes in a seemingly uniform manner.

If this is your first time going through the Tunnel Runner series, I highly recommend that you just stick to the given program; You can add your own features when you finish the base game.

Good Luck.

Thanks for your response. I have indeed finished the base game and this is my attempt to create something different. I’ve really been getting the hang of Blender with this.

I have been trying to create a new delay sensor as you said, the problem is that it does this in reference to the ‘tics’ of the game.

What I am seeing in Wireframe mode, is that the platforms are created uniformly, but every 10 rows or so, 3 columns are spawned on top of each other and I have a feeling it is because of basing it on the tics.

Anyone have a clue of how to proceed?

You should isolate the problem in an independent .blend, so that we can actually see what you’re talking about.

I’ll get you started with something that seems to work properly (attached).


plane_spawn.blend (436 KB)

Many thanks for your help, I think I solved the problem.

With the example given, I isolated two problems:

  • There existed the old ‘spawner’ object with a sensor was still linked to the script, thereby spawning double the amount of platforms at a different delay
  • The main problem is to do with the 3D perspective. Because the player was so much ‘higher’ than the platforms, as the platforms travelled towards the player, they look as if they overlap.

So, I reset everything back to the origin. Then I dropped the delay sensor for something I could control more accurately. I went with an Always sensor that has a timer variable stored in logic and counts the number of tics that have passed by (essentially, we are measuring the distance the platform has travelled… I think). Once the correct time comes, it spawns a new platform and resets to 0.

I played with this value until I could get the appropriate affect, that within the users view all the platforms don’t look overlapped.

If this still isn’t a good solution, please do tell me.

Many thanks!