playMaker

Author Topic: Spawn Scrolling Background (Position)  (Read 1965 times)

rickmiranda

  • Playmaker Newbie
  • *
  • Posts: 11
    • View Profile
Spawn Scrolling Background (Position)
« on: August 23, 2013, 05:57:04 PM »
Hi, I'm hoping to get some help with this issue I'm having.

I have a prefab I made. The prefab is the game background (a resized cube with material) and has the following:
1. FSM for Scrolling the background
    Takes the variable speed of the player object and makes the background speed
    up or slow down as the player object speeds up or slows down. So, the
    background speed can vary from zero to some max.
2. FSM for Spawning a New platform
    The FSM gets the background tile's current position and checks it against a 
    desired final position. If the current position is equal to the final desired
    (within a tolerance of 1e-5) then it generates the new prefab at a location
    determined by the "SpawnPoint" game object.
3. Spawn Point Game object: This is a child of the background prefab and is
    positioned at 3 units from the center position of the background tile. It's
    positioned at 3 units from the center of the background tile because there are
    2 other prefabs in front of the first one.

The game starts off with 3 prefabs. As the background scrolls, when the first tile gets to the final position, it creates a new prefab where the 3rd tile ends. After spawning the new prefab, the old (first prefab) destroys itself.

All this is actually working very well (spawning and scrolling).

The issue I'm having is that when the new tile is spawned, there's often a gap between successive tiles. The positioning of the SpawnPosition Object is perfect since placement of the tile at this position (when in editing mode), creates a seamless joint.

But when running the game, there's this gap issue. The gap is not very large.
I don't think it's because the speed of the tile can vary, I tried this with a constant speed and same results.

Any ideas for correcting this will be great...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: Spawn Scrolling Background (Position)
« Reply #1 on: September 11, 2013, 01:59:04 AM »
Hi,

 Can you look at both of these threads, I am sure it's pretty much what you are looking for:

http://hutonggames.com/playmakerforum/index.php?topic=4510.msg21368#msg21368

http://hutonggames.com/playmakerforum/index.php?topic=1649.msg7220#msg7220

 If not, let me know.

bye,

 Jean