razorMonkey's Forum Posts

  • But does it work now? Or do you thank me just to be polite?

  • I see where could be the problem. If your speed is greater than max speed he will not add enough additional speed to your direction. So I tried with different approach, it seems to work now.

    So instead of subevent in line 2 I added new event in line 3.

    As for adding dt in acceleration and deceleration, my mistake, it seems Custom Movement behavior already incorporates DT in acceleration so ignore my advice here

    (but you will need it for any movement you will be coding on your own)

  • Sorry, I just took care of maximum speed. Now I will take care of the angle of motion.

    Can you drop the .capx here? ...

    No. That would be too easy

    As you can see on the picture, I added two new actions in line 5 and 6 that will take care of the angle of motion.

    Now if you wish that angle of motion follows smoothly angle of submarine rotation it should be the same as rotation of submarine (like in this example, 125). If you want some inertia you should lower it and it will feel like drifting with car. If you make it higher it will act strangely. Try to play with it to get the result you like.

    EDIT:

    also I would suggest that you add dt to acceleration and deceleration, otherwise it will act differently with different framerate

    EDIT 2:

    just ignore line 2, I put animation speed by mistake

  • Ash10500 - he already uses UID

    Unnatural20 - in that case it will check all collisions which will eat more resources.

    Best way would be to first pick 2 objects by UID and then check only these two object for collisions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My pleasure

  • I believe your solution is more hardware demanding because it checks for all collisions and then looks if any collision that happens is the right collision.

    With familliy trick you can pick right instances and then look just at collision between these two.

  • Hi,

    I am from Zagreb, worked in Flash and Actionscript 3, now I work in Construct 2.

    Games are my hobby, but I dream to become professional one day who could live of game development

    My Kong profile with published games (Battlesun 2 is HTML5/Construct 2, else is Flash):

    http://www.kongregate.com/accounts/Razormonkey

  • 1. it should be targetAngle = angle(car.x, car.y, target.x, target.y)

    2. you should compare that angle to the angle of car, so if targetAngle < car.angle it turned right, else it turned left.

    But also there is problem with angle 0 where 0 becomes 360, so it should be:

    if targetAngle < car.angle = right

    or

    if targetAngle > car.angle + 180 = right

    else = left

    Hope it helps, if you give capx maybe I could help more.

  • Excyis, instead of "spawn" you should use "create" and then set angle of motion to "turret.angle + random(-30, 30)":

    https://www.scirra.com/forum/039-on-created-039-angle-changing-does-not-when-spawning_t83604

  • But with random numbers you can adjust chance of each object to appear. For example if you want speed power up to appear twice as often as shield power up.

  • Not sure if there is regular way, although I believe you could "cheat" here.

    Create 2 families, and in both put objects you want to collide. Then pick by first UID first family, by second UID pick second family, and them detect their collision.

    They will be objects of the same type, by defined by different family.

  • Great thing with function is that, if you need to change what it does, you need to do it in only one place, function itself.

    For example if you want PlayerObject to do something else than "set animation to Default" now you need to change it in line 36 and in line 37, so on two places. With more conditions it would be more work.

    With function, you would need to change it only in that function (conditions will point on that function).

  • relativePositionX = object.x - anotherObject.x

    relativePositionY = object.y - anotherObject.y

    If you want distance then relativeDistance = distance(object.x,object.y,anotherObject.x,anotherObject.y)

  • My suggestion is If it ain't broke, don't fix it.

    But if you really want lots and lots of conditions you can use function, but remember to pass object UID into function (with parameter), and then, in function, pick it with "pick by universal ID"

  • First you have to be sure right box is picked beforehand by condition.

    Then you can either put all loot in 1 family and then spawn family (which will give you one random object in that family), or you can use compare variable with random number and else: