InDWrekt's Forum Posts

  • 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.

  • Physics objects are only affected by other physics objects. Your player is not a physics object so it can't affect the block. If all you need to do is, push the block off the edge, there is an easier way to handle it. Take a look at this:

    youtube.com/watch

  • It's a simple fix. Your land tiles just need to have the physics behavior with the immovable property checked.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • C3 has a built in example project called Invert Gravity Platformer. It shows how to swap gravity like in the video.

  • On display, pass the value into the int function. An int cannot have decimals but doesn't round.

  • Not sure what you find confusing about the drift recover. I'll try to make it more clear. The drift recover value is how quickly the direction the car is moving "catches up" to the angle the car is facing. What this means is, when the car is driving straight and turns to the right, it rotates its angle more quickly than the move direction changes. The default value for steer speed or the speed the car angle changes is, 225 degrees per second. The default drift recovery is 185 degrees per second. So, the default car object drifts and it takes almost a forth of a second for the car movement to match the angle of the car. To give the car a more noticable drift, you just need to set the drift recover value lower. A lower value makes the move dirction "catch up" slower so the drift lasts longer.

    Try this, create a brand new car object with all the default values. Then, change the drift recover value to 50 and test it out by driving in a circle. You should see a rather drastic drift.

  • I built this example for a different forum question but it makes use of the caontainer as lionz said. Take a look.

    drive.google.com/file/d/1vObtjdJppTivblySf-rn0Vx4bUH2fYTn/view