InDWrekt's Forum Posts

  • See the new attached example. It should solve the issue. When a red box is destroyed, it creates a blue box in the correct position. Also, it is built so you can completely change the size of the cargo box and (as long as it is a multiple of 20) it will create enough blue boxes to fill it. As for keeping a space between each object, You either need to add an offset of half the space you want between or give the sprite a transparent border. The way I did it was I gave my cargo image a 1 pixel transparent border. This allowed me to have a 20X20 sprite with only an 18X18 colored square. So, if you want your BoxUnits to be 20X20 items but separated by a few pixels, you could give each one a transparent border or, add an offset to the BoxUnits.

    On a side note, this question was a lot more specific. Thank you.

  • That's fine, all you need to do is change the event for spawning the filler object to the destruction of the object you are counting. You will want a variable to store the number of items spawned. Then, calculate the X and Y values from the number of items spawned, not the position of the click. My example should show you everything else you need.

    If the problem you are having is trying to figure out how to get the correct position of the object, you could use the following:

    X:

    ((NumberSpawned % 4) * Filler.Width) + Background.X - (Background.Width / 2) + (Filler.Width / 2)

    Y:

    ((floor(NumberSpawned / 4)) * Filler.Height) + Background.Y - (Background.Height / 2) + (Filler.Height / 2)

    In the above, the 4 represents the number of positions vertically or horizontally you want to fill. In your original question, you said you wanted a 4X4 fill area.

    As I stated in my first post, the question you asked did not explain enough about what you wanted to know. To get good answers in the forum, you need to be able to ask good, clear, descriptive questions. That way, those of us willing to help will know exactly what it is you need help doing.

    Once again, good luck with your project.

  • I know you asked for a .capx example but, I don't think this really merits it. Below is a screen shot of how I would do it. Simply set the Platform VectorX property and set deceleration to 0 while the character is in the air. When the player is on the ground, you set the deceleration back.

    [attachment=0:s6vjutck][/attachment:s6vjutck]

    I hope that gets you what you need and good luck with your project.

  • I'm really not completely sure what it is you are asking. It would help if you explained a little more what you are trying to accomplish and what part you are having trouble doing.

    That being said, I threw together a quick example of what I think I understand your question to be. This example uses a mouse click to spawn a filler object. For the object to be spawned, the mouse must be over the background square. The background is 400 pixels and each filler box is 90 pixels. This will give you the space between you are looking for. The system also makes certain there is only 1 filler object at each location. It allows a second to be created but immediately removes it if there is already one where it spawns. It also clears filler boxes on right click.

    Pay particular attention to how the system picks where the filler is spawned.

    As I said, I am not completely sure I know what it is you are looking for but, hopefully this example gets you what you need to start. Good luck with your project.

  • NormalOne,

    First, I can't help but notice you asked the same question 2 times just 10 minutes apart. Try a little patience. Don't expect immediate answers. Sometimes it takes a little time before someone who knows how to help you sees your question.

    Second, as stated in the manual under the pathfinding entry:

    "The grid of obstacles is only determined once on startup. If objects are moved in the layout, the pathfinding grid is not updated, and objects will continue to pathfind as if the objects were in their old positions."

    https://www.scirra.com/manual/154/pathfinding

    In other words, the pathfinding behavior creates a map at the start of the program. This map is then used anytime the behavior is told to find a path.

    If you continue reading, it tells you how to update the grid manually but warns against it given the CPU load. If you are constantly trying to recalculate the map every time the object moves you are really going to slow down the system.

    "To update the entire obstacle grid use the Regenerate obstacle map action, but note this is a very CPU-intense operation and should only be done on one-off occasions. It is much more efficient to update only small parts of it (ideally only the area that has changed), which can be done with the Regenerate region and Regenerate region around object actions."

  • It appears you only uploaded the .caproj file from your project. That file alone is not enough. It is missing the Events, Layouts, Animations etc... What you need to do is, save the project as a single file. This will create a .capx file which contains all the necessary information for us to open and see what it is doing.

  • Does your character have the "Bound To Layout" behavior? I gave the behavior to the character in the version you posted, turned off collisions and tested it again and got the same results. If I start on layout 2, the player can traverse all of layout 2. If I start on layout 1 and go to layout 2, the character is limited to the area of layout 1.

  • I took a look at your file. Is there a reason your backgrounds have collisions enabled? This appears to be what is stopping the character. An object with collisions enabled is considered an obstacle when path finding. I set collisions to disabled on both the number 1 sprite and the number 2 sprite and the character traversed the entire width of the area just fine.

  • zardaloop

    I have attached a simple example for you. It should give you everything you need. Good luck with your project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have attached a simple menu example that, I hope, covers your needs. It is extensible so if you decide you want to change it to have any number of menu items, you can. It is commented to explain what I did.

    I hope that gets you what you need and good luck with your project.

  • From what I can tell, it is because you are referencing Self.X and Self.Y where you need to reference Touch.X and Touch.Y. Since the action is on the Tilemap, the Self object references the Tilemap X/Y instead of the Touch X/Y.

    Using the Touch X/Y, I did a quick test and got the results I believe you are looking for so, making that simple change should solve your problem. Good luck with your project.

  • There is an example of a platformer shipped with Construct 2 called "Example: Physics - rolling platformer." Open Construct 2 and create a new project. From the template selection, scroll down until you find the above template name and select it. By following the example template, you should be able to get what you need.

    You could find this information by reading in the tutorials about physics. Take a look at the tutorial linked below:

    https://www.scirra.com/tutorials/64/phy ... the-basics

    I hope that gets you what you need and good luck with your project.

  • Take a look at this tutorial:

    https://www.scirra.com/tutorials/685/ma ... ne-concept

    It uses a Canvas plugin to split the image.

  • First, The forums are filled with topics like, "How do I make <insert any game type here>?" Have you searched the forums for similar questions? There may have already been an answer to yours in a previous topic.

    Second, we could be more help to you if you were more specific about what you need help with. Are you having trouble getting the physics to work? Do you need help with designing a system where the player clicks and drags to define the velocity of the ball. Or is it just trying to figure out how to define if the player made a basket. Asking a focused and specific question will get you better results than asking a generic "how do I make my game" question.

    Finally, I don't really know of any tutorials for your specific game idea but, here is a super simple example I just put together. I used some very basic math so, if you want it to react more realistically, you would need to figure out a more appropriate equation for setting the velocity. Also, you probably want to play with the physics settings and add a max strength to the ball's velocity. Be sure to look at all the settings on the objects behaviors.

    I hope that get you what you need and good luck with your project.

  • nickdtsag

    Glad you found a solution that worked. I can see the benefit of your solution compared to the Lerp function. It appears you want the sprite to move at a constant rate along the Y axis whereas the Lerp function would cause the plane to accelerate more the farther from the Mouse Y it is. Just for fun, I thought I would give you an optimization for your method. You can cut your action count in half (I know, 1 action isn't a big deal but this function can help in a lot of other ways as well) by using the conditional operator. I will post a link to the operators section at the bottom so you can read about what it does.

    [attachment=0:174xc1t2]Capture.PNG[/attachment:174xc1t2]

    This single action will do the same as your 2. Just change one of your conditions to not equal then replace the action to set the AirplaneRender.Y to the following:

    AirplaneRender.Y + (Mouse.Y - AirplaneRender.Y > 0 ? 2 : -2)

    https://www.scirra.com/tutorials/77/nat ... uct-2#h2a0