Guizmus's Forum Posts

  • Hey Paul,

    Happy my tuto was useful.

    About your problem, providing a sample capx could help understand what isn't working right now.

    In doubt, I tried this capx where left click makes a bullet going through the wall, and right click makes it bounce on it. Not sure this is exactly what you needed though, but the events logic can then easily be changed, it was the collision detection that was your problem if I understand well.

    Btw, when you're waiting for an answer from someone, or talking to someone in particular, try to add "@name_of_the_person" in your message so he gets notified ;)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The best practice in this field is to make your game framerate independant, as you cannot manage every type of computer. This tutorial can show you how to do it.

    This way, people with low config won't suffer from it playing your game, and people with higher will enjoy it too.

    If you still want to slow down the rendering, I'm not sure there is a way. It would be in the project properties I think, and I can't see anything like this.

    Edit : ninja'd ^^

  • Put in your program big bad loops that slows the runtime ?

    On a more serious note, why would you do so ? It will lag on the screen.

  • I'm all for optimization too, and you can find my thoughts and some techniques in this tutorial, but as Ashley pointed out in this blog article, events logic won't be a problem in most cases, as the rendering is usually the limiting factor of framerate.

    For the typical case you described (+1 every X seconds, do once this event when hitting a fixed goal), I prefer to go with recursive functions. They give you a good control over the situation, and they are trigger-based, meaning they won't be evaluated every tick for the rest of the runtime.

    Here is an example of how I usually do it.

  • Hey,

    It's something you didn't understand, not a bug.

    You have added a "variable", not a key to the dictionary.

    In this capx, you'll find the right way to store a key in a dictionary, and to retrieve it after. I also commented a line showing how to get the variable you had set in the first place.

  • xeed

    As said before, the pathfinding can't do "all" the work here. It can help a lot though.

    When you regenerate obstacle map, it doesn't work because you have some moving obstacles (other tanks) and the obstacle map cannot use those.

    Instead, remove the other tanks from the obstacle map completly.

    In fact, the pathfinding is correct, it founds a good path. It's the "move along path" that doesn't do it correctly for you. Instead, you should code your own movement, making the overlapping tanks stop moving maybe (so they wait for the road to be open again). If you go down this road (haha), take a look at the "Pathfinding.capx" example in C2, as Ashley displays all the nodes on the road found by the pathfinding. It will be useful to build your movement.

  • To locate your problem, you may want to start by looking if the AJAX request is done, or if any problem appends during the request. What does the console give you on the request ? Aborted ? Cross-origin problem ?

    You could also use the "on error" event in C2 to check if the request goes ok or not.

    I tried the same thing you did on a userscript (cross domain AJAX, displaying the return) and had to change my way of allowing cross origin depending on the server I used. This may be also your case, not all servers allow the use of this header, some will make you use an htaccess instead.

  • In the sprite conditions, you have a specific one for the Z-order : pick top/bottom. This will, giving a current selection of those sprites, filter only the top or bottom instance, for you to change its frame.

    screenshot

  • For this to work, you will need a variable to store the angle offset of the start of touch :

    When the touch starts, you calculate the current angle between your wheel and the touch. Let's call this Alpha, Alpha = angle(wheel.X,wheel.Y,touch.X,touch.Y)-wheel.initialAngle

    (wheel.initialAngle is the angle of the wheel when the touch starts)

    Then, while the touch is active, you set the sprite angle to angle(wheel.X,wheel.Y,touch.X,touch.Y) - Alpha

    This will make the wheel follow the touch (as the current angle will change just as the touch angle changes), and when the touch starts, the angle will be set to Wheel.initialAngle (so it won't jump to the current touch angle)

  • The bullet behavior won't be stoped by the collisions on its own. You would have to make a "on collision" -> "destroy" to make it stop when touching the wall, where the physics would do all the job. So there isn't a problem in fact, you just have to do nothing for the bullet to pass through the wall. Instead, you have to add events for the bullet to stop when it hits a real obstacle !

  • No problem ;) If you need the "," for anything else, you can change it in the file with a ";", or any other separator, and change it in the events too (in the tokenAt function and tokenCount)

  • How do you wish to store your "String arrays" in the txt file ? as JSON ? 1 string per line ? with a separator like ";" or "," ?

    Here is a simple capx I made for loading N words from a txt file during runtime. You can store the words as you prefer in the for loop.

    Hope this helps !

  • Ok, got my computer back up.

    As I said, a sample capx is always nice to test. I didn't need your project, just a grid, a player, and a ground. So here it is.

    capx

    It's a tiledBg grid, a snap like I suggested with some offset, and a reposition every tick (that can be optimized).

    Also added a click on grid to spawn the ground just to test if the snap to grid was correct.

  • My computer is down right now, so I'm having hard time explaining and testing, sorry.

    I wouldn't use a sprite for the grid, but a tiledBackground, as it's the same sprite repeated X times. With a single object to move, it would be easier.

    If you need to keep N sprites for any reason, then you'll have to add a different offset for each one, and keep track of witch cell is witch (lots of events/variables for this though).

    If you don't use an every tick, how do you do it right now ? a condition "Player.plateform Is moving" could do it (witch is also an every tick with a condition by the way).

    Hope this helps, I'm trying my best ^^

  • RookieDev

    I'm not sure I understand your question. I can make you an example tomorrow if that's what you need. How did you do it ? Is it working right now ? Can you give a sample capx for testing ?