Excal's Forum Posts

  • If you can figure out how to convert from an on-map scale to pixels, then you should be set.

  • I believe he means stretch.

    Scale outer only works for a small number of games. Other games that need an exact fit don't work well with scale outer, and I hope there is some sort of solution or way to make letterbox scale work in the future.

  • Check their position in relation to viewports, and then destroy accordingly.

    For Each Object

        Object X < ViewportLeft -> Destroy object.

        Object X > ViewportRight -> Destroy object.

        Object Y < ViewportTop -> Destroy object.

        Object Y > ViewportBottom -> Destroy object.

  • I'm a bit skeptical. Reducing file size by massive amounts without any loss in quality seems too good to be true.

  • There is an official, stickied thread in this exact forum for this.

  • R0J0hound, I'm reviving this thread because the issue has come up again.

    I resolved player movement by requiring the player to select squares one at a time. I also believe this is the most optimal thing to do, as multiple paths to a location definitely require player decision.

    However, I am now working on implementing the AI for the computer player and need to discover how to move a computer object to a designated spot.

    <img src="http://i.imgur.com/2ZUNnrW.png" border="0" />

    So here you see the computer has selected one of its objects and highlighted the possible moves for that object. There are two relevant global variables:

    <img src="http://i.imgur.com/fp2igWg.png" border="0" />

    ComputerProgram is the UID of the object the computer has selected.

    ComputerTarget is the UID of a player-controlled object that the current computer object is trying to get to.

    It won't be hard for me to do a distance check and find out which highlighted square is closest to the target. However, I need a way to find out how the computer object is going to move there (what sequence of highlighted squares to move to). I fired up your .capx and found this section to be of great interest:

    <img src="http://i.imgur.com/GGOqrDu.png" border="0" />

    Could you go into a little more detail on how this works? I assume the default values for dirs is just for placeholder.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make the game and see for yourself.

  • makotto, that does it, thanks!

    <img src="http://i.imgur.com/MtArfvA.png" border="0" />

    I've also confirmed the array contents in the debugger.

    I'll get to work on the default behavior next and let you know if I have any issues. AI is a tough subject!

  • I understand I have to store an ID of the family instance.

    However, in terms of the comparison, how would I reference two objects within a family in the same block of code?

  • This is awesome!

  • This is for my board game. I am now at the final stage before it can be considered a working prototype. This is also the hardest stage: creating the computer behavior.

    I've created AI systems in the past, and computer behavior is an area that greatly fascinates me. Here are my notes regarding how the computer should behave.

    Computer program selection order:

    1. Computer uses programs in order of highest range (ComputerPrograms.Range) to shortest range.

    Priority order:

    1. Destroy player programs if they are in range and capable of being killed by a computer program this turn.

    2. (Default) Move toward and attack the nearest player program.

    Local variables:

    TargetPlayerProgram: The UID of the player program targeted by the computer program.

    Destruction potential check:

    1. Loop through each player program and compare its active parts (PlayerPrograms.PartsActive) to the currently selected computer program's damage (ComputerPrograms.Damage).

    2. If a player program is able to be killed by the currently selected computer program (PlayerPrograms.PartsActive = ComputerPrograms.Damage), then set its UID to TargetPlayerProgram.

    Highlight all movable squares (call function "HighlightMove") and pick the highlighted square closest to the player program, then do a range calculation for X and Y (squares are 64px in size, so closest square X + ComputerPrograms.Range * 64 >= PlayerPrograms.X OR PlayerProgramParts.X; repeat for Y).

    3. If no player program is able to be killed this turn, proceed to 'Default behavior'

    4. If range calculation succeeds, then move computer program to nearest square and attack.

    5. If range calculation fails, then proceed to 'Default behavior'

    Default behavior:

    1. Loop through each player program and compare distance along X and Y axes (distance(PlayerPrograms, ComputerPrograms)). Set closest player program to TargetPlayerProgram.

    2. Move computer program to the closest square.

    3. Try to attack the player program. Call 'AttackHighlight' and check if target program is overlapping an attack indicator.

    If so, then deal damage. If not, then do nothing (set ComputerPrograms.Finished = true).

    This thread is intended to keep all my questions in a single location instead of spreading them out over several 'How To' posts in the forum.

    First issue: How do I pick the program with the highest range? In the case of conflicts, I am seeking to just pick randomly among the ones that are tied for the highest.

    <img src="http://i.imgur.com/kzSfBUF.png" border="0">

    BoardGame.capx

    Basically you have to compare the variable ComputerPrograms.Range. ComputerPrograms is a family, and Range is a family instance variable. I'm having trouble figuring out how I would compare family members against each other.

  • All issues concerning player program movement and parts orientation are now fixed.

    I've also implemented program attacking, although you won't be able to test it due to the computer not having any behavior right now.

    <img src="http://i.imgur.com/HZWD5tD.png" border="0" />

    I've also deleted an entire family, reorganized code, added some functions to replace repeated tasks, and more. The .capx should be slightly easier to understand for people who might be trying to use it as a reference.

  • Will the player understand that his decision to wait for the correct weather is why he was able to solve a problem?

    You never want the player to think he just got lucky and that's how he solved a problem. In fact, the player may even feel cheated if he believes he didn't solve the problem himself.

  • Damnit vee41, I was trying all sorts of complicated things and all you did was fix things by removing one line...

  • I've discovered something peculiar. There is a definite problem for the space to the right of another square, and I don't exactly know why.

    <img src="http://i.imgur.com/wmOCt54.png" border="0" />

    <img src="http://i.imgur.com/0P7KsBj.png" border="0" />

    <img src="http://i.imgur.com/Rtz48d6.png" border="0" />

    This is the relevant code:

    <img src="http://i.imgur.com/C3fI0qL.png" border="0" />

    Time to figure out why...