AllanR's Forum Posts

  • you can put the object(s) in a family, then pick the first one by the object and the second one by the family.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Harlequin

    check out this thread from yesterday: https://www.scirra.com/forum/how-do-i-do-custom-pathfinder-for-hex-maps_t152368

    R0J0hound wrote an outstanding example of how to implement the A* algorithm - which is similar to Dijkstra's Algorithm

  • Majinboo

    well, I am not sure I fully understand what you are trying to accomplish here, but I restructured your capx the way I think you want it to work... (it looked like you wanted to allow up to 2 of any name to be pinned, but after that no more of that name could be pinned).

    I didn't use the HavePin and PinDuplicated variables because I was able to do it without them, and they were just complicating things (you were only marking pinned ones as duplicated but that was not stopping additional ones of that name from getting pinned because if they were unpinned they were not being told that name was already duplicated).

    also, you were running the duplicate check on every tick - over and over again, even though most of the time nothing was changing. It is good practice to only check for things when something changes. So, now it only looks for duplicates before it tries to pin the current instance.

    http://www.rieperts.com/games/forum/PinnedObjects.capx

  • matriax yeah, I understand the need to use Key Is Down for those kinds of functions. I just wasn't clear on why you would need to hold down a key while changing layouts... but I see there could be possible scenarios for that too.

    in the testing I did yesterday, C2 does not realize a key is still down when it gets to the next layout (neither the "Key is down", or "On Key Released" events fired - and I would think that is a bug in C2 (but Ashley might say it is that way on purpose, or too difficult to change now to make it worth fixing). So, you might want to consider filing a bug report and see what he says...

  • R0J0hound - wow, that is an awesome capx example!

    TELLES0808 - CPU usage is actually quite low the way it is now (not many tiles, and it randomly chooses a goal rather than trying to find an optimum goal based other game factors). My iPhone ran it for over an hour (at 60 fps) without getting warm - and usually just about any game makes it get warm pretty fast. On my PC, cpu utilization was around 10% (after I made it wait for me choose a move it dropped to 5%.) So, I think it should scale to bigger maps with more pieces nicely.

    while my phone was happily running it I was playing with the capx on my computer - I made it wait for you to click on a tile to move to, and had it display how many steps that was, and what the total cost would be. I also added a tile that cost 10 to see how it handled more complex terrain configurations. (it handled it extremely well)

    That was way more fun than what I should have been working on! : )

  • matriax is there a reason you are using "Key Is Down" rather than "On Key Pressed" ?

    on key pressed will only fire once when you press the X key.

    Key is down will fire many ticks in a row, even if you think you only briefly pressed the key. (what seems like one press to you is like 10 to the computer since it is running 60 times a second.)

    Every tick that the X key is still down will set the Action1 variable to 1 again, and that will cause the Action to get called again (so that could skip several layouts).

    Use "On Key Pressed" if you can (unless there is a good reason why you need to let the user hold down the X key).

  • Majinboo

    I would do the UID instance variable the other way around:

    instead of storing the names,UID in the PinName object, I would store the PinName.UID in the names object.

    Then, anytime you pick a names object you can see if its PinNameUID variable is 0, then you know nothing is pinned to it. If there is a value in there, then you can pick the PinName object directly by that UID (rather than having go searching for PinName objects pointing back to the names object). That should simplify your code a lot.

    (unless, of course, you want to have more than one PinName object pinned to the names object at a time... but it doesn't look that way to me)

  • ohhhh, I see... yeah - that could be nice to have.

  • edubrrx

    I am not quite sure what you mean by "frames" but I made a 9-patch example for someone recently to select units in a game. It has a thin frame and transparent middle. It might be along the lines of what you are wanting...

    basically, you set the margins to the thickness of the frame you want, then you can have as fancy of a frame as you want. (you may have to set the edges to Tile if Stretch makes it look bad)

    http://www.rieperts.com/games/forum/Starcraft_map.capx

  • just set your Action1 variable back to 0 in the block of code that calls the action, then perform the action. You don't need the trigger once and it wont run again on the next layout. You don't need the wait this way ether.

  • every object already has an angle attribute. you could just, on every tick, set angle to object.angle + speed * dt to go clockwise, or object.angle - speed * dt to go anticlockwise. The angle will stay where it is when you change directions.

  • TELLES0808

    well, kinda depends on how your game will work, are you building a two (or more) player game and want to show/highlight possible moves, or suggest the best possible move? give a hint? Or have a player play against the computer and build an AI that will be able to play the game by itself?

    the logic would go something like:

    specify a start block (and possibly a target block) - then if you are rolling dice, calculate all possible moves and the benefit of each move, sort them and pick the best move. Or if it is just a matter of deciding how far you can move for a specific cost, or how far you can move without making units vulnerable, then factor that into the cost/benefit of each possible move, collect the results in an array as they are calculated, sort and pick the move with the best result.

    A human can glance at a board like that and rule out most of the inefficient moves instantly. A computer needs to brute force calculate every move to know what to do.

  • the "guide" sprite probably had the Scroll To behavior, which would make the games automatically center itself.

  • The only time I had a blank screen was when I accidentally made an infinite loop. Do other capx files preview ok?

  • you really only need to test (in compare variable) if it is Greater Than or Equal to 11 seconds, then give them 200 points, then add an ELSE give them 100 points.