GameSalad

Set Distance Between Moving Actors

brett-nortonbrett-norton Posts: 64Member, BASIC

Hi All

Could anyone help me with the following please.

I have actor platforms moving left across the screen at random times.
Platform 1 = Low
Platform 2 = Middle
Platform 3 = High

The width of the platforms is different, i want to know how i can set or constrain the distance between the right side of the current platform on the screen to the left side of the next random platform.

So in essence the platforms are different sizes but the gaps in between can be set manually and can be increased over time.

Thanks in advance.

Comments

  • tatiangtatiang Posts: 10,971Member, Sous Chef, PRO, Senior Sous-Chef

    The distance between spawned actors will be determined by the delay between spawn times. So if you want one platform to follow another at a distance, you would need to specify the delay before spawning the second one.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • brett-nortonbrett-norton Posts: 64Member, BASIC

    Ok well i had pretty much got it 75% right with having position X be the controller rather than timers.

    When platform position X = 900 change random next number.
    When platform position X = 450 Set Spawn to true.

    I was trying to do away with timers as i assumed they would be heavy on resources.

    If your saying im good to go with timers i should be ok with that method.

  • tatiangtatiang Posts: 10,971Member, Sous Chef, PRO, Senior Sous-Chef

    I would think it would be harder without timers but I'm not entirely sure. If you have it working without Timers, great, but if you don't then give them a shot.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,711Member

    @brett-norton said:
    Ok well i had pretty much got it 75% right with having position X be the controller rather than timers.

    When platform position X = 900 change random next number.

    If you are using Move or Move To or Change Velocity (in fact anything other than Interpolate) to move your platform actors then they are very unlikely to ever land on x=900.

  • tatiangtatiang Posts: 10,971Member, Sous Chef, PRO, Senior Sous-Chef

    @Socks said:

    @brett-norton said:
    Ok well i had pretty much got it 75% right with having position X be the controller rather than timers.

    When platform position X = 900 change random next number.

    If you are using Move or Move To or Change Velocity (in fact anything other than Interpolate) to move your platform actors then they are very unlikely to ever land on x=900.

    True, you might need to detect when they are less than or equal to a positional value.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Posts: 12,711Member

    Whoops, yep ! Forgot to include the solution, use <= instead like @tatiang says.

  • brett-nortonbrett-norton Posts: 64Member, BASIC

    I really tried not to ask but im about to throw in the towel with this one.

    Im struggling to think of a way to have 3 platforms with 3 different sizes randomly spawn with a set gap in beetween them.

    Any ideas please?

    In theory im thinking there needs to be a current platform number and a next platform number.

    And if current is 1 and next is 2 spawn next at this time. And having the time set for each diffrent size platform to alllow for the same gap in between. Surely there is an easier alternative. I cant get my head round how to implement the idea.

  • SocksSocks London, UK.Posts: 12,711Member
    edited May 17

    @brett-norton said:
    And if current is 1 and next is 2 spawn next at this time. And having the time set for each diffrent size platform to alllow for the same gap in between

    Sounds pretty confusing to me ! If your goal is to set a fixed gap, let's say 100 pixels, I think it'd be easier just to say 'when this platform has moved on by 100 pixels then spawn the next one' ?

    Attached is a very quick demo file of what I mean.

  • brett-nortonbrett-norton Posts: 64Member, BASIC

    Socks your an absolute legend, Great Demo. Thanks

Sign In or Register to comment.