Ruskul's Forum Posts

  • I would make a group that is responsible for creating 10 enemies and set it to inactive. The group when activated would spawn 10 enemies and then set itself to inactive. Every time an enemy is destroyed (on object destroyed) I would subtract 1 from enemy_count and then check if enemy_count = 0. If it does then enemies_spawn_10 group needs to be activated. You could also wrap the group up in a function and call it instead (passing it a parameter indicating how many enemies you need spawned). This would allow you to have multiple events that can spawn enemies in any number meaning you don't have to write a bunch of similar code.

  • One way you could do this is this: (I am referencing a mouse object)

    Create a small object and every tick change its location to that of the cursor.

    if(left button is down or finger is down)

        If small object is overlapping button object

            add dt to some timer variable

            If timer variable >= to some time (3 seconds)then start game

        Else set timer variable to 0

    On left button or finger released set timer variable to 0

    The syntax is actually very similar to programming in anything else (I do c#, vb, c++)

  • Thanks, I learned about rotation matrices and stuff today from an electrical engineer but this is a lot more simple. I need to learn this

  • I just realized if I can calculate arbitrary Xg,Yg from x,y based on angle of gravity then I can calculate x,y from Xg,Yg after making necessary changes. Do you think this is the best way to do it?

  • Hello all,

    I have a math question for those of you who are gifted in the area. I can't find it through google because I am not sure how to ask the question.

    Basically the problem is this: I have a physics object with velocity x,y. Because I need to know it's velocity relative to an arbitrary axis I calculate that and store it as Xg,Yg (it's based on the direction gravity is pulling where Yg relates to relative up/down). I calculate Xg,Yg based on polar projections using GravityAngle. Now here is what I need to do- I check Xg and if it is under a certain threshold I need to set it to zip, but the only way I can do that is by setting the objects velocity which is stored as x,y. what is the equation to alter the objects velocity in x,y such that Xg will be 0 and Yg will remain the same, and vica versa?

    Thanks

  • Hey thank you though. I really think construct 2 is an amazing tool. I appreciate the time you take to help us users out. I switched to it quite recently form xna and though sometimes I wish I could just code events, everything is well worked out and the flow is quite smooth. Thank you for all your hard work. It's fantastic.

  • The test has ordinary sprites lined up on the left side. objects predictably collided with every internal edge in this case. Tiles maps work well in some cases but it seems that the context of the tile influences whether or not an internal collision occurs. I know there are ways to avoid this, such as using edges to border an object, but I don't know how contruct2 interacts with box2d. It may be entirely box2d or not. I have worked with it in other cases and avoided problems but that was in c# and I wasn't trying as many complicated things.

  • Thank you! I looked for the better part of 3 hours for that formula but I didn't even know how to phrase my question into google. vector projection... I kept looking for something about surface normals. Much obliged.

  • Hello everyone,

    I have quite a problem I have been working on for the last few days. In a nut shell, I have a game where gravity changes (is constantly changing. I am using physics behaviors on all objects.

    Basically, at the beginning of the event sheet, I determine need to determine what surfaces the player is touching (up,down,left,right) and what directions the player is moving relative to the force of gravity (up,down,left,right)

    I have solved how to determine collision surfaces and what side they are on. I also feel like I know how to solve the other problem.

    my events look like this:

    -----

    //finding the angle the player is moving and the distance traveled

    player travel angle = system angle(oldx,oldY, currentX,currentY)

    player travel distance = system distance(old vector, new vector)

    //checking if player is moving "up"(given gravity can be at any angle and up is the way gravity is not pulling)

    if travel distance is greater than 0 (make sure the player is moving)

    and if the smallest difference between the angle of gravity and the players travel angle is greater than 90.

    -------

    I wouldn't mind being able to check what the distance traveled along the arbitrary axis of gravity would be either, but I can't seem to figure out how to calculate that. Normally if gravity is down it is easy to see how far along each axis an object has traveled because the angle of gravity is aligned with x and y (therefore if y distance is less than 0 it follows that the player is moving in an upward direction)

    Anyway if anyone is familiar with this stuff let me know. I can't share the capx due to nondisclosure stuff.

    thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I checked out your capx file and was confused. It seems to just crop normally instead of doing appropriate zooming. Am I missing something?

  • Hey thanks, I had been using contruct classic at the time (i'm not sure if it had that option - maybe it did) c2 has it though. Thanks for your help!

  • I am so sorry, I posted the wrong file.

    *dropbox.*com/s/20rwcuvnrzfeh2p/CollisionsProblem.capx

    Sorry about the mix up.

  • Hey,

    I can't help but feel like there should be one more scale mode to choose from. It should be like letterbox integer scale mode but with cropping to extend to the edges of the screen... or rather there should be a zoom mode on crop. I want that pixel look but I want the screen to be filled.

    Ideally I would simply make hi res "retro graphics" and use non integer scaling but that results in seaming (there won't be a fix to that right? Why not? it seems solvable to me I did it in xna..., but then again I am not sure I know how they implemented it in construct 2 and limitations with java script and stuff) <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Link to .capx file (required! If link is blocked remove the http and www parts):

    *dropbox*.*com*/s/f45szxyb0pl3gjr/problemrender.capx

    Steps to reproduce:

    1. Enable physics behavior on an object and environment

    2. create a tile map with square and triangle collision tiles

    3. roll a ball ( physics object) around the environment

    Observed result:

    depending on what tiles are nearby, the circle will catch on internal edges. Depending on how the tile map is set (with respect to how many tiles and whether the collision polygons are square or otherwise) dictates where an object will catch an internal edge. In many cases it seems random, but when the game plays it is always in the same places. I have elasticity and friction set to 0 which means the ball object should not bounce off of a smooth surface. This allows the problem to be more apparent as no objects colliding with 0 elasticity should bounce apart.

    Expected result:

    Internal edges should be ignored by collision.

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: yes

    Operating system & service pack:

    windows 7 64 bit, service pack 1

    Construct 2 version:

    Release 158.2 64 bit

        

    I have elasticity and friction set to 0. This allows the problem to be more apparent as no objects colliding with 0 elasticity should bounce apart.

    There are several concurrent tests in the project. Starting from the left side- The first wall is made up of perfectly aligned objects repeated to make a wall. The ball is being launched at the wall at random speeds. When the ball hits the wall it bounces off of whichever internal edge it hits first. This is predictable. It can be solved by doing what is done in test #2. Simply use one physics object so there are no internal edges. Test 3 shows a wall made of a tile-map's various tiles (all with square polygon collisions). The wall behaves perfectly expected. The ball hits the wall and slides downwards unobstructed. However, not test #4 the ball is colliding with an internal edge, seemingly triggered by the neighbor tiles. I moved the tiles around and it very much has to do with what surrounds the tile. The final test shows how if you put a ramp tile at the end of a bunch of square tiles (this works outside of the tile map as well) The ball will "trip up" on the internal edge between the two and rather than smoothly gliding off of the ramp there is a noticeable pop in the upwards direction.

    Is there something that can be down about this? I know internal edges is a huge problem in collision detection, depending on what method is used (such as speculative contacts) I have used box 2d in other applications, including simply as a library in my own xna games, and did not come across this problem. I was wondering if there was perhaps a problem in contruct2 when it is setting up the collision polygons.

    Any insight and or help would be greatly appreciated. It is possible that I could make a work around but that means I loose the ease-ability of using tile-maps. It also means I will have to make alot of extra objects to avoid any internal edges (and since my game is quite ramp heavy, that is alot of objects, some of them quite large)

  • SirSpunky, I would love to see the script modifications you made. I was wanting particles to follow their emmiter for other reasons (mostly I want some effects not to trail around).