InDWrekt's Forum Posts

  • You need to use an instance variable, not a global variable. Instance variables are set on and only affect an object. Global variables are non-specific, hence the name global. Each tank will have an instance variable called health with a starting value of 30. Then, only the tank whose variable reaches 0 will be destroyed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK, I think I understand what you are looking for now. All you want is to force the object to move only on the X-Axis, right? Not, as you said [quote:giy1ciz8]know whether you're moving left or right

    All you need to do is, in the drag and drop properties, change the Axes to Horizontal instead of both. Select the object on the right and you will see it's properties on the left.

  • This change will stop the endless loop but it doesn't do the same thing. From this image, it looks like you are just trying to make your objects flash after touching the text object. If this is correct, I would suggest you make use of the flash behavior instead of using your events the way you have them set up.

  • In your while statement, you are saying while aux < 5 but you are not incrementing the aux. That means aux will always be less than 5 and the loop will repeat for ever (or at least until you run out of memory and the game crashes). This is called an Infinite Loop.

  • There isn't a condition, but there is an easy way to do it. All you need is a variable to store the position of the object when it was not being dragged and compare it against the X value of the object while it is being dragged.

  • Read the license comparison on the page linked below to see the differences between the licenses.

    https://www.scirra.com/store/construct-2

    You need a license for any game you make if you are going to make money from it. It doesn't matter what platform it is on or if that money is earned from sells, in-game ads or in-app purchases.

  • It has already been stated that Scirra plans to include a discount to upgrade from C2 to C3 but it will still have a cost. See this reference from a blog post by Ashley.

    https://www.scirra.com/blog/155/the-future-of-construct

    [quote:1nmgbr0v]Construct 3 is likely a long way off, and upon its release we plan to have a great upgrade deal for existing Construct 2 users. Further, we are confident Construct 3 will be able to import Construct 2 projects, allowing you to easily transition over.

  • When you say "dice roll," I am guessing you mean you want the computer to choose a random value. Take a look in the manual at the random() system expression:

    https://www.scirra.com/manual/126/system-expressions

    Since random returns a float (or floating point number), the return will be a decimal. You will want to get the integer value from it.

    Something like this would get what you want:

    int(random(1,111))

    *note: random returns the a number below the high value so to get 110, the high needs to be 111.

  • ekajuan

    It seems you kind of missed the point. I used the word "If" in places where something might happen but has a chance not to:

    [quote:12zvvbrp]If number rolled is a double: roll again

    This isn't to mean the AI event system will be like a giant embedded/branching If statement, although it could be modeled that way. It was just to show the events may or may not take place. The entire original post was more to explain the steps of evaluating the actions ON PAPER so you have a guide of what decisions the AI will have to make.

    Personally I think using a State Machine is easier than a giant if statement for this type of system. However, to use a State Machine, you would have to know what it is and how it works. A State Machine would store what state the AI player is in and have certain valid next state conditions that the AI could choose.

    For Example:

    AI player turn Starts

    State:

    Has not rolled yet

    Exit Conditions:

    Roll Dice

    Offer Trade

    AI Chooses to Trade - New State

    In Trade

    Exit Conditions:

    Complete Trade

    Trade Completed - New State

    Has not rolled yet

    Exit Conditions:

    Roll Dice

    Offer Trade

    AI Chooses to Roll Dice - New State

    Rolling Dice

    Exit Conditions:

    Dice Rolled

    Dice Rolled - New State

    Moving

    Exit Conditions:

    Finished Move

    AI Finished Move - New State

    Has rolled

    Exit Conditions

    Offer Trade

    End Turn

    Notice the AI can return to certain states. The AI is in the "Has not rolled yet" state after each trade and before the dice have been rolled but cannot re-enter that state after the dice have been rolled.

    Again, a State Machine is another advanced system that it will take some time to learn if you have never dealt with one before. I again would like to encourage you to get more experience designing clones of games like Tetris, Galaga and Pac-man to build your skills as a game designer before you dive into an AI system like this.

  • You do not have permission to view this post

  • Unfortunately, you aren't going to find a tutorial for every single thing you want to do. What you need to do is, read and build many small simple games that add to your understanding of AI until you can design the system your self. A true Monopoly opponent AI is a complex system to design. Something that, in my opinion, would need a much better understanding of AI than just [quote:138fj3r4]simple AI like in platform game.

    I know it is tempting to try and rush ahead to push your skills but, it is more detrimental than beneficial to skip the process of learning how to design your game. By design I mean, writing a document that describes exactly how your game will react/interact before even booting up your computer. Counting on tutorials to give you each piece of what you need will make you a worse game developer.

    Before beginning any game project, you should create a design document. This document should explain all the rules of the game and how each object will interact. It should also include some information on the style and scope of the project. Next, break down the things you need the AI to do. Take out a piece of paper and think of all the things the player must do on their turn and all the things they can do if they choose.

    Must do items, such as rolling the dice, are easy. Here is a simplified breakdown:

    Must Do

    Roll Dice

    Move number on dice

    If number rolled is a double: roll again

    If landed on Go To Jail: go to jail

    If landed on Chance/Community Choice: draw Chance/Community Choice Card

    If landed on Property owned by other player: pay player rent value

    etc...

    Optional Items are where the actual AI comes into play:

    Optional

    If in jail: decide whether or not to pay to get out of jail (must take in account if a get out of jail free card is held or money available to the AI player including money from mortgaging)

    If on unowned property: decide whether or not to buy property (must take in account money available to the AI player including money from mortgaging)

    If property auctioned: decide whether or not to bid (must take in account money available to the AI player including money from mortgaging)

    During turn, decide if a trade will take place and with whom (must be able to offer an appropriate trade that would benefit the AI but would possibly be accepted by the other player)

    If offered a bid: accept/reject (must be ale to decide if the trade would be beneficial to the AI)

    etc...

    Of course this isn't everything you will need to have on your list, just a simplified list. After you write the list, it is up to you to decide how to simulate these choices in the code. Because Construct 2 works on an event system, it would be best to write your list in an event/action style similar to how I did above, [quote:138fj3r4]If landed on Go To Jail: go to jail

    After you have completed your design document, you should build the entire game, minus the AI. Get all the rules working properly. Ensure that the game is built fair and balanced. Make sure the players have access to all the features of the game and that they cannot do anything that would not be allowed in the real board game. If you can get the entire game working 100% as a multiplayer game, then and only then should you start trying to implement AI opponents.

    Finally, you will add in the AI. On each turn the AI must define which step above takes priority, then include some amount of randomness so the player doesn't just know exactly what the AI will do.

    This post isn't to discourage you from making your game. It is meant to encourage you instead to slow down and take some time learning more before attempting something on this scope. some of the best game designers in the industry suggest all new game designers build clones of the old classics long before attempting more modern games.

  • On the right hand side of the screen, there is a folder under projects that is the base of your project. If you select that, the properties panel on the left will show an option called "Window Size."

    You can also get these same properties to show by clicking the view link on the left side of the screen next to where it reads "Project Properties."

  • davidross900

    If you change MaximumSpawnTime to 4.5 instead of 5 your resulting spawn speed will be every 0.5 seconds (5 -spawnTime = 0.5 where spawnTime = 4.5). Just takes a little basic algebra.

    I hope that helps and good luck with your project.

    [Edit] just to be clear, you would change your Set spawnTime method to:

    spawnTime = min(spawnTime + 1, 4.5)

  • davidross900

    Yes, that is correct. What you have in the image above will stop the variable SpawnTime from being set higher than 5. In your spawn event, you should see objects spawn between than 0 to 3 seconds at the fastest.

  • It looks like you might be going with Tyler's method but, to answer your question:

    [quote:33afw4ed]interesting, i never knew about this function before. How should i code it?

    /b]

    You code it exactly as I typed it:

    [quote:33afw4ed]min(spawnTime + rateChange, maximumSpawnTime)

    Replace rateChange with the amount you want to change the variable with. In your picture you are just adding 1 so, replace rateChange in the above with 1. Replace maximumSpawnTime with the maximum you want the spawnTime to be. If you don't want the spawnTime to be higher than 5, replace maximumSpawnTime with 5. Other than that, you can copy and past this equation directly into where you are setting the variable. Again, use the "Set Variable" method, not the "Add To" variable method.

    I hope that clears things up for you and good luck with your project.