How do i speed check

0 favourites
  • 13 posts
From the Asset Store
Have you ever dreamed of playing in a Speedball game or tournament?
  • I must have a checker to speed of flying fireballs. How can i create condition-

    when fireball impact with wall with low speed, fireball inflict 10-20 damage

    when fireball impact with wall with medium speed fireball substract 21- 35 damage.

    I have use angrynerds example in this tutorial i can set power of shotting projectiles from 0 to 100 power

  • Its all dependent on your current code and behaviors. what behavior is the fire ball using? if its using physics then you can get its velocity.

  • if you use Physics you can get the speed of an object like that

    distance(0,0,Sprite.Physics.VelocityX,Sprite.Physics.VelocityY)
  • Yeah i use physics.

    I must have add that code in condition editor or event editor?

  • What I wrote isn't a condition nor an action. It's an expression. Expression can be used anywhere. This one return the speed of your object, so if you want to compare speed you can use that in System: compare two values or if you want to use speed to calculate damage you can do a System: set damage to distance(0,0,Sprite.Physics.VelocityX,Sprite.Physics.VelocityY)*anyKindOfMultiplier

    So yeah... you do what you want.

  • thanks Yann i check this soon :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yann Thank you for good hint :)

  • If you're confused about the distance expression..

    another way of doing it is:

    sqrt(sprite.Physics.VelocityX^2)+(sprite.physics.VelocityY^2)

    because it's basically that.. maths thing.. you know.. working out the long side of a triangle and sh*t. yeah.

    I don't think most people would have thought about using the distance expression... but hey it all works.

  • This sounds professional :)

  • By the way, talking of using function to do something they weren't meant to, you can do a :

    cos(angle(0,0,number,0))

    to get the sign of number.

    Basically if the number is positive, the angle is 0 and if it's negative the angle is 180.

    cos(0) = 1

    cos(-180) = -1

    you will have the equivalent of the sign() function in Construct Classic

  • I can use this all in System: compare two values? (confused)

  • you can compare any expression to any other expression via the 'System: compare two values' yes

  • One question, how slow down volecity of fired ball? i mean if bal hit the box( box destroy) ball rushes on to the front and another box... every time when ball destroy box, ball slows down a little ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)