How do I make a random line

0 favourites
  • 4 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • So I want to make a random line, that always goes up (never goes down again). If you have any idea how I can simply do that, that would be nice. I want my sprite to always stay ontop of that line if he falls off; its game over.

    I decided to spawn my sprite everyime my previous sprite.Y was equal to 0 and then do that over and over again so it would eventually be an infinite random line, also everytime it spawned the line would turn a little around it axis, so to keep the line "not straight". The "line" is actually a rounded rectangle and I'm trying to create the illusion so that when they spawn on eachother it looks like a straight line.

    My problem is everyway I try this, the line stops after 1 spawn or never spawns at all.

    I included a sketch, to try and make this clearer, I hope you can read my handwriting <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    (if you have problems viewing the picture try this link then: http://imgur.com/s0nHDfe )

  • Something like this ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Something like this ?

    I adjusted the capx a bit so you could see what I mean.

    The line needs to go down, I can do that but that means it should always keep spawning another sprite when going down. I could ofcourse adjust the i variable to 1 million, but that would need to much processing power. and it wouldn't exactly be infinite

  • I'm pretty sure there is a nicer way to do it, but it works

    It also prevents the sprites to go outside the window on the left and right.

    Edit : sorry, I updaded the wrong file, here is the new and working one !

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