Ruskul's Recent Forum Activity

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

  • Try Construct 3

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

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

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

Ruskul's avatar

Ruskul

Member since 23 Nov, 2013

Twitter
Ruskul has 2 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x6
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies