random spawn and set number

  • so i want to make a tree grow and when its grown i wanna harvest it, i wanna be able to click and destroy the tree and then spawn at random point the number of trees i destroyd, for exemple, i destroy 2 trees i spawn 2 trees, but whats happening is , i destroy 1 tree it spawns on all spawn points. i want to be able to control how many trees i ahve in the game so i tryed adding treecount to the sprite variable but i cant seem to understand how it works, can someone help me and maybe send me a capx to understand better

  • I''m not quite sure what you want here. Are you saying you want to destroy your tree and spawn another one when you destroy it, or do you want to spawn one at a later time ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well, i think you have to save the number of trees you've destroyed in a variable

    set an ammount of time (or ticks) for the new tree to sprout

    set sprout locations

    pick a randmo sproutlocation instance

    sprout! (create object(tree) instance at sprout location instance which was randomly picked)

    substract 1 from the trees to sprout/spawn

    be awesome!

    harvest

    destroy that mofo

    add 1 to the trees to be spawned

    hope it helps

  • I''m not quite sure what you want here. Are you saying you want to destroy your tree and spawn another one when you destroy it, or do you want to spawn one at a later time ?

    yes i want to destroy one tree and right after that another one spawns, also appart from that i want to be able to plant my own tree... how can i say this... i want 2 trees to always spawn when i destroy them, and to be able to plant more trees if i want to,you getting this?

  • well, i think you have to save the number of trees you've destroyed in a variable

    set an ammount of time (or ticks) for the new tree to sprout

    set sprout locations

    pick a randmo sproutlocation instance

    sprout! (create object(tree) instance at sprout location instance which was randomly picked)

    substract 1 from the trees to sprout/spawn

    be awesome!

    harvest

    destroy that mofo

    add 1 to the trees to be spawned

    hope it helps

    hmm i dont get it, i get the concept but i dont know the tools very well from construct.. maybe in more detail? or with a capx.. thanks anyways

  • Something like this http://www.viewtalker.co.uk/c2/Trees.capx - maintains a count of how many trees there are and makes them to order at a random choice from a spawning point ?

    NB: It would be really handy if I could upload files rather than FTP them ....

  • ok, its something like

    -0--0--0--0--0--0--0

    -0--0--0--0--0--0--0

    -0--0--0--0--0--0--0

    -0--0--0--0--0--0--0

    all the 0's are the spawnpoints, which are instances of an object (a sprite for example)

    you have to Pick Random Instance of Sprout Point, and when you do, destroy the SproutPoint

    then, when you destroy the tree, create a SproutPoint where it was

    when you destroy the three, set a global Variable with the numbers of threes you've destroyed

    Tree ~double click then

    Create Objet Sprout Point tree.x tree.y tree.layer

    destroy tree

    set TreesToSprout = TreesToSprout +1

    every N ticks (where N is the numer of time elapsed)

    pick random SproutPoint

    create object Tree SproutPoint.x SproutPoint.Y SproutPoint.layer

    destroy SproutPoint

    set TreesToSprout = TreesTo Sprout -1

    its the most simple i can explain, hope you got it

  • Something like this http://www.viewtalker.co.uk/c2/Trees.capx - maintains a count of how many trees there are and makes them to order at a random choice from a spawning point ?

    NB: It would be really handy if I could upload files rather than FTP them ....

    yes! this is it, thanks a bunch!

    i can do something with this now, really thanksfull

  • > Something like this http://www.viewtalker.co.uk/c2/Trees.capx - maintains a count of how many trees there are and makes them to order at a random choice from a spawning point ?

    >

    > NB: It would be really handy if I could upload files rather than FTP them ....

    >

    yes! this is it, thanks a bunch!

    i can do something with this now, really thanksfull

    btw it seems like sometimes it spawns on the same spot, how do i make it so it doesnt spawn on the same place ?

  • Can't try it at the moment, but could do it with tree collides with tree - don't know if this works,if it does reposition it,or in my example deleting the tree will make it appear elsewhere, also this will help balance trees at sdpawn points

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