help a noob :)

0 favourites
  • 10 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi Forum - this first time poster, long time lurker and all time noob needs a hand :)

    I'm trying to make a little infinate runner/jumper game that will involve several changes in gravity along the way - I've been looking at the gravity platformer tutorial for inspiration, but it seems to be somewhat overkill for my use...

    the concept is very similar to what s made in this video youtube.com/watch?v=o-l6DA9I77E    ( sorry cant post urls yet :/ )

    I have no problem getting the player to change gravity orientation from starting position to new position (as in the video - from the earth to the moon) but how can I make a system that enables the player to change back ?

  • In that youtube link it looks like you could just do the same again in reverse as he did to jump from earth to the moon?

    On collide with "red" & Orbit = 1 Then set angle towards (earth.x,earth.y) & set orbit=0.

  • yup! thats more or less what I tried in several different ways (not that you coul know sry)

    i try to do something like this

    player on collide with "red" & orbit 0 then set angle towards (planet.x, planet.y) & set orbit 1

    (and the next event reverse it)

    player on collide with "red" & orbit 1 then set angle towards (planet2.x, planet2.y) & set orbit 0

    but.. that doesnt work - seem like the orbit variable changes and checks cancel each other out and the result is that the player now wont change its initial gravity angle.

  • How odd!

    Any chance you could upload a capx to peek at?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Since the event sheet works top to bottom, when it gets to the second event, it's also true since the first event set orbit to 1.

    I would create a function and call it when the collision happens. Pass it a parameter of orbit. Then in the function, check the param if it's 1 set orbit to 0 and vice versa.   I hope that makes sense, if not I can try to explain it a bit better.

  • Thanks guys! I can't quite graps how the function solition would avoid the "canceling out" problem, but i'll give it a shot and see :) (need to wrap my head around functions anyway :) )

  • Well since you are passing the orbit value into the function as a parameter, it takes the value at the time of calling the function. Changing the value of orbit inside the function won't effect the value that was used when it was called. Does that make sense?

  • I made a rough example. Hope it helps.

    https://www.dropbox.com/s/hdpa33idvslenfa/function.capx

  • HAH! Sucess!!! oh the joy !!!

    the function worked great - didnt know that the paramater wouldn't interfeer with the initial value... that will certainly come in handy in the future... only hickup was to figure out the right way to compare the paramater value .. but that worked out aswell... so thanks a lot :)

  • You are welcome. My example might answer that question for you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)