R0J0hound's Forum Posts

  • Had a tinker with the idea and it does end up with an optimal move path. I also tested out some ideas i had for implementing turned based mechanics. It may have some use to give someone some ideas...

    https://dl.dropboxusercontent.com/u/5426011/examples18/turn_based.capx

    r139, 43 events

    I agree moving your units one space at a time would give the player more control and could be a better control mechanic.

  • Ah, the "g" flag does help. Why use RegexMatchAt() and then rebuild the string when you can just use RegexReplace() where everything is done in one call?

    This now removes all numbers and not just the first number.

    RegexReplace("Hello123", "\d", "g", "")

  • I haven't opened the capx but you should be able to get it to work without any path finding at all. I mean when you highlight all the possible moves for a piece you already have a number for how many spaces away it is from the piece.

    So if you select a spot four spaces away you can select a spot three spaces away next to that. The process can be repeated to find all the grid positions in the path. So you end up with a list of positions that you could move to in sequence with the move to behavior.

    At least that's a thought. I don't have access to c2 ATM to implement it.

  • Try this to remove digits from a string.

    RegexReplace("Hello123", "\d", "", "")

    I haven't tested it but it should work.

    My sources of info were the system expressions section of c2's manual and some JavaScript regex guide I found.

  • While that would suggest a limit, there isn't one. I did a test and C2 is able to draw 40,000 objects at once, way more than 2,500. It can likely do many more. The only limit being the speed at which they are drawn, which is caused by cpu and gpu speed.

  • For the math on the speeds and directions of moving through portals there is a capx here:

    http://www.scirra.com/forum/portal-vector-realignment_topic48791_post306636.html#306636

    For standing halfway through the portal and being seen on both ends it's doable with layer masking effects to hide a portion of the player. You'll be using two player sprites at that point for each portal. The most complicated bit will be handling collision detection for the player when moving through the portal. The main example of the problem would be a portal mounted on a solid wall, the wall will have to be set to not be solid or something when passing through. This is where some ingenuity and creativity will be required to get something working.

    For your last question... Put frosting on a loaf of rye bread. If that cake isn't a lie I don't know what is.

  • Checking collisions with 2 objects instead of 6 would be faster since less needs to be checked. With a small number of sprites the performance difference would be negligible, but it could be more beneficial if you have many.

  • One idea that may make it a bit easier to control is to only let the "ComputerProgramSpawn" function get called when not waiting.

    1. Create another local in the "computer spawning" and call it stall.

    2. Add to event 48 a compare stall=false

    3. And change the wait in event 52 two three events:

    set stall to true

    wait 1 second

    set stall to false

  • When not shaking you can simulate bounded with something like this:

    set scrollx to clamp(scrollx, screenwidth/2, layoutwidth-screenwidth/2)

    set scrolly to clamp(scrolly, screenheight/2, layoutheight-screenheight/2)

    I didn't verify the expression names but the idea should be sound.

  • There is no example of this combined with a bubble shooter example that I know of but this topic has some general info on a way to pick a chain of objects.

    http://www.scirra.com/forum/matching-more-than-3-sprites-gem-matching_topic51703.html

  • I wouldn't say a bug really as all "trigger once" is run once every time the previous event changes from false to true. So within a loop i'm unsure what it should do at least I can't wrap my mind around it.

    The is overlapping is only false when none of the objects overlap, so trigger once is working as expected if the for each is removed.

    Or perhaps it is a bug. What do you think the expected behavior should be in the case of the example? Or should there be another condition like "trigger once per object"?

  • Centra

    The two issues you are running into are newly created object picking and dealing with picking multiple instances of the same type separately.

    Created objects become the only picked object for the the rest of the event. In the case of event 1 and 2 the 2nd spawned sprite will always have "isanswer" toggled. Also the created object object won't be able to be picked as normal until the next toplevel event (event that isn't a subevent) however a triggered event such as "on created" or a funtion call doesn't count as it's more like it's run right when it's called. Your on created event as it is has only one sprite picked (the new one) which can be somewhat solved by adding a "pick all sprite" system event, but you still won't be able to pick the other spawned sprite until the next toplevel event.

    And that leads nicely into issue #2, picking multiple instances of the same type separately. There are two ways to deal with this:

    * The first way is to pick one of the instances and save the values you want to compare into local variables and then pick the 2nd and do the comparison. It would look something like this:

    + Some event that picks two sprites
    ---local number inst0frame=0
    ---+pick sprite instance 0
    ------ set inst0frame to sprite.frame
    ---+pick sprite instance 1
    ---+compare inst0frame = sprite.frame
    ------ do something

    * The second way is to use single object type family. So you can pick two objects of the same type separately using two different names. You can think of the family name as an alias to the object name. Events would look something like this:

    + Some event that picks two sprites
    ---+pick family1 with uid of sprite.uid
    ---+pick family1 instance 0
    ---+pick sprite instance 1
    ---+compare family1.frame = sprite.frame
    ------ do something

    Ok, and in respect to what you're trying to do you can simplify it by putting the sprite into a family and call it say family1.

     +every 3 seconds
    ---create sprite
    ---set sprite frame to random
    ---create family1
    ---set family1 frame to random
    --- +while
    --- +compare sprite.frame = family1.frame
    -------set family1 frame to random

    cheers

  • Hi,

    Here's your original capx with commentary on the problem events and what they do.

    https://dl.dropboxusercontent.com/u/5426011/fixed/tobye_orig_comments.capx

    And here it my cleaned up version.

    https://dl.dropboxusercontent.com/u/5426011/fixed/Tobye.capx

    Finally here's a simple capx that shows a feature of picking that was causing you issues.

    https://dl.dropboxusercontent.com/u/5426011/examples18/picking_behavior.capx

  • I do think this happens to everyone. If you look at the "website issues" section of the forum there is on average one topic per page about the issue. The oldest is on page 30 of the 31 pages, which shows that it's been around for a while.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well doubt what you may. I'm willing to be impressed if this project is successful.