How do I draw points at regular distance

0 favourites
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hi there,

    I've been making a gesture path drawing for a sprite to follow. Everything works fine except for the path drawn with the mouse. I'd like to have dots to be spawn at a regular distance from one another.

    Anyone has an idea on how to do that ?

    Here the .capx I'm working on : https://www.dropbox.com/s/7befiup6yrfwx ... .capx?dl=0

  • For Loop

    base + increment*loopindex

  • Thanks

    but how do I implement that ?

  • Thanks

    but how do I implement that ?

    Sorry, I didn't look at your capx so not sure what you are doing exactly, but here's an example to explain what I mean and you can apply it to your situation.

    Let's say you want to create 10 sprites starting at coordinates 100, 100 and every 25px moving straight right (increasing X):

    ON whatever triggers

    -For startindex=0 endindex=9

    --create sprite at location x = 100 + 25*loopindex; y = 100

    This will create 10 sprites at x coordinates 100, 125, 150, 175, 200...

  • Well, I managed to make it work on a computer but it despertly doesn't work on a touch device.

    Here is the capx : https://www.dropbox.com/s/kabhgy1qz9rtg ... .capx?dl=0

  • > Thanks

    > but how do I implement that ?

    >

    Sorry, I didn't look at your capx so not sure what you are doing exactly, but here's an example to explain what I mean and you can apply it to your situation.

    Let's say you want to create 10 sprites starting at coordinates 100, 100 and every 25px moving straight right (increasing X):

    ON whatever triggers

    -For startindex=0 endindex=9

    --create sprite at location x = 100 + 25*loopindex; y = 100

    This will create 10 sprites at x coordinates 100, 125, 150, 175, 200...

    Hi Badmood,

    thanks for the advice. Actually I'm trying to draw a path with the mouse spawning dots on a regular distance. Then, a sprite follows the path

  • Hi Badmood,

    thanks for the advice. Actually I'm trying to draw a path with the mouse spawning dots on a regular distance. Then, a sprite follows the path

    Ah, I didn't catch that. Maybe:

    Pick most recent waypoint (or player if no waypoints)

    -Compare two values If distance(mouse.x, mouse.y, waypoint.x, waypoint.y) > [distance you would like them]

    --spawn waypoint at mouse.x mouse.y

    Sorry, I can't look at your capx right now so not sure if that is the behavior you are looking for. If it is, to pick the most recent waypoint you may need an instance variable or boolean—although I think there is an expression to pick the last created instance but I'm not familiar.

  • Thanks

    But I'm afraid I'm not good enough with Construct to really understand your advices. If ever you sometime have the chance to look at the capx, it might tell you more about my needs.

  • Give this a try:

    https://www.dropbox.com/s/9uwvydzy1dsf0 ... .capx?dl=0

    Not sure it is the best way but worked with what you had started. I was impressed with some of what you had—haven't done anything like that before

  • *deleted post*

  • Hi

    Thanks for the compliment by I have been helped and used my basic skills to adapt this help to my needs.

    Your last submission is interesting for its new approach but still does't work on touch device. It's very strange how touch/mouse react differently from computer to touch screen. Any idea about that Ashley ?

    BTW, there are 2 points I implemented on my last attempt :

    • red dot appears once path has been drawn
    • once a path has been drawn, it's impossible to draw another one until the one on screen is deleted or completely achieved by the moving dot
  • It works perfectly on my iphone6. It is probably your device

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also works perfectly on old ipad mini

  • Laurent

    Just a heads up:

    You are allowed to delete your own posts using the 'X' icon on the right side of your post frame. Deleting just the contents looks messy IMO.

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