How do I cap an object's max speed

  • Hi everyone,

    So one of my resolutions this year is to return to several games I let go to the back burner last year and get these games done. one of the problems I faced with this game (FredEx) is that the physics of C2 were so responsive that I had problems with collision detection with walls.

    In FredEx you flick boxes into the backs of trucks. My first attempt (seen in this video) was with GameSalad which seemed to have a generally slower less responsive physics system which in the case of this game worked in my favor.

    This was a rough early version, but notice how the mouse and the object are not locked together. There is a kind of lag because the frame rate / vsync / whatever that gamesalad was a little sluggish.

    Construct 2 on the other hand is a hyper responsive so with you drag the item it's locked to your finger and flicking can result in some incredibly fast flings which in some cases would break through solid objects that should normally stop the boxes..

    so... TL;DR

    I need to figure out a way to have an object I drag have a max speed. I've experimented with the various physics parameters in C2, but I must be doing something wrong because everything i tried never got me anywhere and thus resulted in me abandoning taking the game further. I need to know the boxes can never get outside the dock. Throttling the objects max speed should help prevent the problem i'm having.

    What I'd ideally like to see is just what you see in the video.. the boxes basically lag a little.. like they can't keep up with my finger if i move too fast.. and of course if i move slowly then they can catch up.

    one of the latest versions of the game can be seen here. I have all the assets I need to get this game pulled together if i could just master this dragging

    Thanks!

    Caleb

  • bump. there must be a way to have an object have a speed throttle somehow.

  • Just set angle towards the mouse/touch on selected and set a max speed..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LittleStain thanks for this. I'll try it out. I've been working in Cocoon IO lately to get a couple of projects wrapped up so I hadn't had a chance to test this out.

    Thanks!

    Caleb

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