Random platform spawner issue

tzunitotzunito DenmarkMember Posts: 15
Hei guys, first and foremost thank you for a great community. I've learned alot from reading comments and threads in here.

I'm looking for help with an issue i ran in to last night. I'm trying to create a small game where the game is a fluent motion from right to left. And my actor has to jump from platform to platform and shoot possible enemies.
My actor will be set at the same location on screen at all time, and all the player has to do is press/touch two keys in order to jump and/or shoot.

What im trying to do is to spawn random layers thats going to be used as platforms for my actor to jump on, but the problem at hand is that the layers spawn on top of eachother and at the same time and sometimes multiple spawn together making the scene clumsy to look at.

I have 5 different Layers
I've made a Real/index and called it Random_Front_Layer

My setup is:
Timer -> every 1 seconds (run to completion set) -> change attribute: game.Random_Front_Layer to Random(1, 5) ->
Rule (all chosen) -> attribute: If game.Random_Front_Layer = 1 -> do Rule -> Spawn actor: Layer_Front_1
place: front of layer
direction: 0 to scene
From position 560, 40 relative to scene

and added: accelerate 180 relative to scene with acceleration 150

And i've basically just copy pasted and made the attribute = 2 for layer to and etc

If anyone understands this and can help me out im grateful, only been at this for four days and im having a great time.

Tzunito

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2014
    @tzunito


    What im trying to do is to spawn random layers thats going to be used as platforms for my actor to jump on, but the problem at hand is that the layers spawn on top of eachother and at the same time and sometimes multiple spawn together making the scene clumsy to look at.

    I have 5 different Layers
    I've made a Real/index and called it Random_Front_Layer

    My setup is:
    Timer -> every 1 seconds (run to completion set) -> change attribute: game.Random_Front_Layer to Random(1, 5) ->
    Rule (all chosen) -> attribute: If game.Random_Front_Layer = 1 -> do Rule -> Spawn actor: Layer_Front_1
    place: front of layer
    direction: 0 to scene
    From position 560, 40 relative to scene

    Layer 1 will always spawn the actor at 560, 40 . . . . . is this what you want ?

    I'd guess that if you want your platforms to be random, you might want the height (vertical position) to be different each time ?

    You don't give the values for layers 2-5, so maybe each of these position the platform in a different vertical position, giving a pseudorandom effect ?

    I'm not 100% what you are after or what you are doing, but you could try making the vertical position random instead of fixed . . . . .

    Every 1 second
    Spawn actor
    Position x = 560, Position y = random (10, 200)

    ?
  • tzunitotzunito DenmarkMember Posts: 15
    Wow thanks man, those 26ish minutes were paid well out! Also learned that my version of GS doesnt have Iphone 5 width 568 as default but iphone 4 width 480 (i believe), need to take that in consideration! :)
  • tzunitotzunito DenmarkMember Posts: 15
    edited February 2014
    @Socks
    I used Jamie_c' turtorial and it worked out like i wanted it to. But thank you for commenting :)
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
  • tzunitotzunito DenmarkMember Posts: 15
    @Jamie_c
    Sorry for bothering you again mate, but after I watched your video i noticed that my player actor pushes the layer actor (or rather stops it in place) and the next layer "floats" into the first layer making them overlap.

    I have 3 questions for that (tried google, GS forums and youtube for my exact scenario of running game):
    1. Is there a way to make them not overlap and not move when touched by player?
    2. Can I make the player "die" by touching the side (or stop and fall)
    3. Is there any videos out there that could help?

    Tried to make an invisible layer spawn atop of the first layer, but seeing that the first layer randomly spawns at ?? x and ?? y I just cant seem to make it spawn atop all the time.

    Hope you have the time to help a rookie once again, learning alot and having tons of fun :)
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @tzunito, I've updated the project file that is attached to this post. I've added a couple notes to the player actor and platform actor to let you know what I did exactly. This update stops the platforms from moving/overlapping if the player touches the side of them.

    #2, The player should fall off the edge of the platform as it stands now

    #3, if you are interested I teach a class at udemy and in there you learn to build a complete endless runner game as one of the three projects. It's linked in my signature below.

    Hope this helps some.
  • tzunitotzunito DenmarkMember Posts: 15
    @jamie_c
    Just looked at the Udemy, and im pretty sure im gonna take that class in a few weeks when i get paid. Seems like there is a lot of stuff to be learned.

    Just opened the endless runner GS file, when i press preview the player spawns immediately and just flashed fast at its index place, and the platform wont start. Looked through the rules and such and all were the same as the video besides the added ones.
    Can it be the difference in windows to MAC user?

    Sorry for being a bother,
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @tzunito, no worries or bother. :) Sounds like that last file might have gone corrupt or something, a new one is attached here. Let me know if you have any better luck.
  • tzunitotzunito DenmarkMember Posts: 15
    @jamie_c
    Sorry to say its the same, but if the behaviors and rules are taught in your class ill just learn it from there when i buy it.
  • tzunitotzunito DenmarkMember Posts: 15
    @Jamie_c
    Just bought it, couldnt wait to learn more about this great program!
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @tzunito, weird about the file. I'm going to be updating the tutorial on my website soon with this file so I'll post here when that is complete.
Sign In or Register to comment.