InDWrekt's Recent Forum Activity

  • I answered a similar question here construct.net/en/forum/construct-3/how-do-i-8/optimize-code-158547

    If you take a look at this example: drive.google.com/file/d/1yG8azZPg66Ve6QxSHzGXY6LHqg8GmBc0/view

    You should be able to get what you need. It uses a JSon file to hold conversation information and a local variable on the character to record where in the conversation they are.

  • You're welcome. Glad I could help and good luck with your project.

  • Your file was unavailble when I tried to download it so I didn't have it to work with. I built a simple concept that I think should have all the things you asked for though:

    drive.google.com/file/d/1g34uTHMpVszjBiE4HmWTWv3dUqlFnyoB/view

    Problem #1 & #2

    I get around this by, rebuilding the object every time a change is made. I don't rely on the image points. I just place them above the base object the height of the image * the position in the array.

    Problem #3

    (Modifying) - This part is taken care of by rebuilding on change.

    (Changing Cost) - For this, I store the price in the array and update it when I update the image selected.

    Hopefully this little project gets you what you need to complete your project. Good luck.

  • 1 - Each instance of the object manages it's own instance variables. In other words, when you trigger an action: Enemy -> set current patrol point, it will only change it's own current patrol point. If you are looking for how to set each enemies starting value for their instance variable, you can select the enemy and look at the left side menu. There is a list of the instance variables there and setting them only affects the selected instance.

    2 - All you have to do is, set the point you are giong to next back to the first one if it would be set to a point that doesn't exist. If you only have 3 patrol points and adding 1 to the current point variable would increase the number to 4, set it to 0 instead. There are lots of ways to do this. You could increment the number, then immediate check if it is invalid and change it. You could use an if statement (if value < 3 set value to value + 1 else set value to 0). This could also be done in a ternary (value < 3 ? value + 1 : 0). Personally, I prefer to use the MOD (%) operator. Using MOD divides the value you are passing into it from the total number of points you are using and returns the remainder ( 3 % 10 = 3 and 13 % 10 = 3 because both return a remainder of 3. This is also the case for 100000000003 % 10 = 3)

    Finally, you can see this information in use in the linked example.

    drive.google.com/file/d/1DezxktPQOyTO7XzIwLjc0c_g2PA1GvXS/view

  • There really isn't enough information in the screenshot to be able to answer your question. To really be able to help you fix a bug in your code, it would be best if you attached your project for us to work with.

    However, without actually playing with your code, I believe a project I built to answer a previous question can help you as well. Take a look at this:

    drive.google.com/file/d/1BFP_BkjSzgAKj7A2-rRAQ4g-jKEUIcqp/view

    Specifically, take a look at the setPlayerStopPosition function.

    Hopefully that gets you what you need. Good luck with your project.

  • Dude, that looks great. Glad I could help. Good luck with your project.

  • You do not have permission to view this post

  • I can see you are new here so I am going to give you some friendly advice:

    First, read this forum post:

    construct.net/en/forum/construct-2/how-do-i-18/tips-posting-quothow-iquot-40390

    The suggestions in that post will help you get better answers to your questions.

    Second, it is not our responsibility to build your game for you. You need to learn the tool and figure some things out yourself. Go check out the tutorials. There probably isn't one about your specific game type but if you follow them and build the games they show, you will have an understanding of how the engine works. You can also check out all the sample projects that ship with Construct. You can answer a lot of your own questions with them. Then, if there is a specific problem that you are having that doesn't have an easy solution, ask it here.

    YouTube also has a ton of tutorials and examples. Good luck with your project.

  • You don't actually need that image to solve the problem. All you need is to know the distance the pixel is from the center of the image. Here is a simple project built off the Noise Textures built in example:

    drive.google.com/file/d/1A1jzWoIMUB5N3A0cF1GmfRzEnMWsHHn9/view

    Notice the event the sets the pixel:

    -> System: Set NoiseValue to (AdvancedRandom.Classic2d(XIndex, YIndex)

    - (distance(XIndex, YIndex, LayoutWidth ÷ 2, LayoutHeight ÷ 2) ÷ 400))

    × 100

    I am subtracting the distance from the center:

    distance(XIndex, YIndex, LayoutWidth ÷ 2, LayoutHeight ÷ 2

    divided by 400 which is the max distance of an edge to the center in this example:

    (distance(XIndex, YIndex, LayoutWidth ÷ 2, LayoutHeight ÷ 2) ÷ 400))

    It's super simple but kind of math heavy. Hopefully it helps though. Good luck with your project.

  • What you are looking for is, a state machine. Basically, a state machine is a series of code (actions and events) that contain and update a state variable with certain actions that can only be triggered if you are in a specific state. I built an example of a boss type fight using a state machine for a previous forum question that could help you out.

    drive.google.com/file/d/1t3nFqiq7syZXKRWGSOE-VrwVknfgDbeV/view

    Notice how each action checks the state value of the boss. Also remember, a state in a state machine must have an entrance case (an event that occurs in a different state that sets, or enters the new state) and an exit case (this is an event that is an entrance case to another state). Notice in the example how ever single state has at least one action that sets the state to a different state. These are the entrance and exit cases.

  • Just a little information about a loop that may help explain why this is not the correct way to do what you want:

    Loops in construct are intended to complete in a single tick. Introducing a delay the way you are trying would completely pause your game until the delay is over because no other processes could complete. Instead, a delay in a loop will just delay between actions that happen within each iteration of the loop.

    What you need to do is, record which position of the array you are on when you hit the delay and, exit the loop. Then, after the delay time is complete, start the loop again at the index you recorded. This is called an iterator.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
InDWrekt's avatar

InDWrekt

Member since 19 Sep, 2011

Twitter
InDWrekt has 7 followers

Trophy Case

  • 13-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies