R0J0hound's Recent Forum Activity

  • adcornaglia

    That bit is already implemented in C2.

  • A global variable would be the easiest. You can get the name from the player with a Textbox object, and then set the global from that. So say you call the global variable "hero", you can then build the text the npc says with an expression like:

    "hey " & hero & " how are you?"

    hero & " , can you get me this stuff?"

    The key thing is "&", which combines values together as text.

  • Using the expressions:

    Sprite.ImagePointX(point)

    Sprite.ImagePointY(point)

    Replace "point" with either the index of the of the image point like 0 for the origin, 1 for the first image point, 2 for the second,... and so on.

    ...or you can use the name of the image point.

  • It's true, events are run top to bottom. However triggers (they have a green arrow to the left) are only run when they are triggered, but if there is more than one of the same trigger they are run top to bottom. Basically you could move the triggers around and the game will run the same as long as they have the same order. "on collision" and the gampad triggers are the exceptions. They are not real triggers, and are run in order with everything else in the event sheet.

  • Braus

    Sure, why not? In the capx it calculates the initial speed so it rotates n degrees. It's done when the speed is >= to 0.

    So you'd either figure out the number of degrees from any position to any other, or find a formula that can do that.

  • One way to do that path exactly could be:

    https://dl.dropboxusercontent.com/u/542 ... ollow.capx

    It could be made to move at a constant speed by splitting the curve up into lots of lines and make the time to move on each line proportionate to it's length.

    There are other solutions too:

    search.php?keywords=follow+path&terms=all&author=&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search

  • Try it. The math will make it scale from (centerx, centery) regardless where the origin on the sprite is.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You probably just want the spinner to slow down and when it stops just check if the angle is close to one of those.

    For example here is an example if there are four values on the wheel:

    +-----------------+
    | mouse: on click | spinner: set speed to random(100, 400)
    +-----------------+
    
    +------------------+
    | spinner: speed>0 | spinner: subtract 100*dt from speed
    |                  | spinner: rotate self.speed*dt degrees clockwise
    +------------------+
    
    +------------------+
    | spinner: speed<0 | spinner: speed set speed to 0
    +------------------+
       +---------------------------------------+
       | spinner: angle is 45 degrees from 0   | add 10 to score
       +---------------------------------------+
       +---------------------------------------+
       | spinner: angle is 45 degrees from 90  | add 50 to score
       +---------------------------------------+
       +---------------------------------------+
       | spinner: angle is 45 degrees from 180 | add 1337 to score
       +---------------------------------------+
       +---------------------------------------+
       | spinner: angle is 45 degrees from 270 | add 123456789 to score
       +---------------------------------------+[/code:3y93chdi]
    
    So in other words it's not necessary to know where it will stop beforehand, you just check the angle when it stops.  There I checked the angle with the "is within angle" condition but the "is between angles" could be used too.
    
    And in relation to your questions about my capx above:
    To make it start with more speed just set the start speed higher in the click event.
    The spinner is stopped when the speed is less than or equal to 0.
    It's not zero because we can only calculate speed per frame, and seldom will the speed end on 0 at exactly the frame time, so it overshoots slightly.
  • #3

    This can already be done by making the object global.

  • I don't think any of those are an application of the genetic algorithm. Mercuryus's example tweaks the jump as it goes but it's not following the algorithm. Radulepy's are more like ai examples.

    I tried my hand at the algorithm and came up with this:

    https://dl.dropboxusercontent.com/u/542 ... netic.capx

    It does this:

    1. simulates 100 objects moving with 5 seconds worth of random input

    2. scores them

    3. kills the lower 50

    4. creates 50 new objects by combining two of the survivors and adding some random mutation

    5. and finally repeat.

    It doesn't converge very fast but given enough time it will converge on the objects moving as far along the path as possible. I imagine the scoring could be improved to help it converge faster but I'm probably done with this.

  • It doesn't use a behavior at all. Here's a working example of the idea:

    https://dl.dropboxusercontent.com/u/542 ... ette2.capx

  • You could use the math here: