InDWrekt's Recent Forum Activity

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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

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