Tips needed to create simple mechanism

0 favourites
From the Asset Store
Background Story generation templates. See the Arcade demo.
  • Need something similar to that http://www.gry.pl/gra/zagubiona-owca

    How its best way to create that folding of parts the road?

    1st thing i use drag & drop

    but i need tips how to connect parts of road (i have one idea but im afraid its too complicate to make it quick)

  • i have got an idea :

    make 2 images points for each road part , the first is the man image point (0) call it (bottom) and place it in the beginning, add another image point (1) call it "top" and it's obvious place it in the end of the" part. give each part a value call it order(integer) to test if the roads are correctly ordered or not .

    then when you drage and drop a road part , make a test

    if that sprite_level1_part2.order = sprite_level1_part1.order + 1 then {

    • set the position of sprite_level1_part2 to other object at image point "top" or (1) .

    // construct 2 will place the sprite based on it's principal image point so it will be in the right position

    }

    else if the sprite_level1_part2.order # (Not equal to ) sprite_level1_part1.order + 1

    then place it back to it's original position.

    i didn't try this i just hade it in my minde , i hope it works as i thought.

  • warville i think your idea about image points its big step for me i will check this right now

  • i know what is missing for me. I need only condition When Sprtie.road. Animation frame0 (with variable called 'part' = 1 ) is overlapping Sprtie.road with Animation frame1 (with variable called 'part'= 2 ) > set position to another object Sprtie.road.

    How make that condition ?

  • i don't understand what you are trying to do ? why you need different frames ? just differents sprites ! using instance of the same sprite is complicated because you can,'t make condition (is overlaping) on instances of the same sprite it's very complicated.

  • warville different frames because Sprite Road have in his animation many road part (frames)

    I add screenshot, this should work. Of course first and second part of my road have this same variable value 'road =1' to connect andt dont work. wierd

    'part' is variable of road sprite

  • What you have made is strange. Please try to do it as i suggested. Make different sprites for each part part1 part2 part3 and don't forget to set position on other sptrite on image point(1) not (0) because 0 is used already in the previous one.

  • warville thanks for your tips i think will be better when i use One sprite (with animation frames) to one level because if you import separated parts(15-30 parts) for each level imagine how many will you have to import to 10 levels.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe my tutorial/example will help.

    Drag & drop Correct Place

    Personally I wouldn't use different sprites as each road. Use animation frames for the roads as you have done but use a copy for detecting if it's in the right place.

  • Minor thanks, that 'draghere' sprites to check is old and well checked method, im wondering why my condition on screenshot dont work?

    I attach my capx maybe some one take a quick look and come a good idea of ​​what need to be improved in code

  • You'll need to use families for this way to work properly. Here's a quickly hacked together edit to your .capx think it works as you want I haven't fully tested.

    I've added the needed instance variables to the family variables so you can check the states correctly.

    [attachment=0:yj8pzblw][/attachment:yj8pzblw]

  • Minor yest something is going on now finally

    i update with one more thing take a look how it works now I'll carry a few amendments and will be perfect.

    You can take this example to yours group of tutorials and create tutorial

    Hmmm i saw this now.... it works with correct order too?? yes:)

  • Yes it will only connect a road piece to a piece that is already placed correctly.

    You'll have to work on placement a bit as it will place a piece where it was dropped so technically you could drop each piece on top of each other. Personally I would do like you did with the startx & starty variable and hard code the correct position to 2 variables and snap there when dropped.

  • i have made a solution to you problem using only one sprite object for a road using frames as parts : it works 100%

    • if the part is in correct order and you droped it close to the previous one it will stick to the right position
    • if the part is not in the right order it will go back to the original position.

    as i have seen in the solution above you need a lot of work to make stick in the right position.

    here is the event-sheet below it may look conplicated but it work correctly:

  • warville good example. Thanks for your initiative.

    I modify Minor's example and i made this its very similiar to yours

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