resdesign's Recent Forum Activity

  • I am wondering if there is a way to create a function that will do something for different elements.

    Here is what I mean:

    I have several droppables (drag1 to drag6) that I want to go to a certain position when they are dropped. They first overlap an image (either one of d1 to d6) and then they are placed under the proper image.

    Right now it works but I basically have to repeat for each draggable:

    if drag1 is overlapping d1 then set drag1 position to d1.X and 202
    if drag1 is overlapping d2 then set drag1 position to d2.X and 202
    if drag1 is overlapping d3 then set drag1 position to d3.X and 202
    if drag1 is overlapping d4 then set drag1 position to d4.X and 335
    if drag1 is overlapping d5 then set drag1 position to d5.X and 335
    if drag1 is overlapping d6 then set drag1 position to d6.X and 335
    [/code:j876r2cs]
    
    Then I have to do this for drag2 to drag6.
    
    This seems so redundant.
  • 99Instances2Go - I used the following:

    if score = 6, set score to 7 
    if score = 7 slide in good [/code:2x9t1a0v]
    and it works.
    
    FYI, for the 'not so good slide' I added a new variable called 'done' and add 1 to it when any drop is done. At the end if check both score and done.
    [code:2x9t1a0v]if score < 6 and done = 6, then slide in 'not so good'.[/code:2x9t1a0v]
    
    [b]Thanks for your help.  I wish there was a way to mark your answer as correct.[/b]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your input. I will try these and let you know probably tomorrow.

  • I am using drag n drop on 6 items. Every time they are dropped in the correct place I add 1 to the global variable score.

    I have a text set to score for a visual feedback and it is working fine. The score reaches 6.

    When score = 6 I need a screen to slide in. However, though I think I have the correct code the slide does not move in.

    Set up: 6 labels - 6 boxes - six check marks - 6 red crosses. (feedback items show when element dropped).

    Code:

    system/compare variable score

    if score = 6 then move slide in (using LiteTeen) (LiteTeen is set to start from beginning)

    This does not work so I added another global variable finished = 0

    then I have if score = 6 then set finished to 1

    if score = 6 and finished = 1 then move slide in - set animation to frame 0 (good! image)

    if score < 6 and finished = 0 then move silde in - set animation to frame 1 (not so good! image)

    Does not work either.

    I tried to put the score variable on an every tick even too. still not joy!

    Any idea why this is not working?

  • i have the same instances for all the icons from 0 to 9 set in the UI. I gave them the same name inst_ID

    so I have:

    • obj_icon inst_ID 0 to 9
    • obj_icon2 inst_ID 0 to 9
    • obj_check inst_ID 0 to 9

    It seems like since I check these against the same variable, they should be the same. I could PM you a link to my file is your are willing to look at it. I am a beginner and things mystify me a little coming from javascript.

  • I have 10 icons with inst variable. obj_icon with click event

    I have 10 other icons with the same inst variable. obj_icon2 with draggable

    I have 10 other icons with the same inst variable. checkmark to show result.

    I have a text to show the value of checkIconNum to make sure it is correct.

    On the click event, I have a global variable that is set the the obj_icon instance variable and then this icon is destroyed to eliminate the click event.

    On the drop event of the second icon, I have this code.

    My problem is that there is no consistency. the 2 first chosen icons work as expected and then the following ones sometime work correctly, sometimes the wrong icon is detroyed.

    Could anyone tell me what I am doing wrong?

  • OK. I put the icon on 2 rows to see what happens. for solution 2, I also use pick for the obj_icon since I need to destroy that one too.

    But the result is not consistent.

    Here is an example:

    picked inst 3 - works

    picked inst 8 - works

    picked inst 0 - works

    picked inst 5 - check mark correct but obj_icon instance 9 is destroyed instead of 5 while the text shows 5 correctly.

    picked inst 1 - check mark correct but obj_icon instance 2 is destroyed instead of 1 while the text shows 1 correctly.

    picked inst 4 - check mark correct but obj_icon instance 8 is destroyed instead of 4 while the text shows 4 correctly.

    so this is really bizarre!

    Any suggestion why the result is weird?

  • Actually I am not sure why only part work but not all. As you can see in code below I tried 2 things:

    Solution 1: variable checkIconNum is set when clicking on the icon.

    Then in the drop event I pick the obj_icon and set it to ID_CHECK

    This works but since the obj_icon that has the click event is still there, then you still can click there to bring the question in

    Solution 2: I use the checkmark icon (obj_check) and set its inst_ID to checkIconNum

    I destroy obj_icon so the click event is destroyed too

    I set the opacity of obj_check to 100

    Solution 2 does not always work for some reason.

    Any idea why? Is the wait even not enough for the system to know what is going on?

  • OK! I actually changed thing a little. I added an animation to the obj_icon. I added a variable that is set on the click event to be equal to the obj_icon_ID. then I used:

    system Pick obj_icon instance checkIconNum and then set this icon to the animation.

    Thank you for directing me to "pick"!

  • I have a simple game in which I need to access the instance variable of some icons in order to have only a specific icon show.

    Here is the set up.

    I would be so happy if someone could help.

    I have 10 icons that are used for click events. This is an animation for which I have 10 frames and each copy is set at a different frame and has a different instance ID from 0 to 9 just like the frame numbers. These are called obj_icon

    I have 10 icons (obj_icon2) that are under these with same instance ID. these are used for drag and drop.

    Then I have another icon which is a check mark. These have also the same instance ID. Their opacity is 0.

    When I drop each icon, there are some feedback on the map. The original icon is detroyed and then the ckeck mark should change opacity. However, I am not sure how to do this because right now it changes all the checkmarks instead of only the one with the same ID as the obj_icon.

  • Update:

    It is working now. My take.

    As suggested by Chris Dmm on FB:

    Separate the layout for the intro screen from the game layout

    Add the screens on the layer and make it global.

    Voila.

    Not sure why it does not work when the screen are on the same layout though because the code is exactly the same.

  • OK. I made a sample with just my start screens and it is working. So there must be something in the game that is interfering. So I am working on it changing some settings to see if the problem is corrected.

resdesign's avatar

resdesign

Member since 5 Nov, 2015

Twitter
resdesign has 1 followers

Connect with resdesign

Trophy Case

  • 9-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies