Drag n Drop Image Replacement

0 favourites
  • 6 posts
From the Asset Store
320 high-quality cinematic sound effects for trailers and game scenes.
  • Hi,

    I am trying to replace sprite(tile) with a drag and drop sprite, and make layer become visible. (see attached Cabx)Also, I added layout random (just 3 layouts inn project) I have tried different ways. Made a global variable/local (TileCount, and I can not get it to work. I think the condition is not working to make layer 3 (Complete) visible. Then again it might just be the way I coded it. So if anyone can help me or point me in the correct direction, I will be very grateful for any help.

    Link to Cabx Example:Tile Replacemet Example

    Thanks,

    John

  • You are using instance variables, global variables and family variables.

    You are changing the instance variable and then destroying the instance while you are checking if the family variable is 2.

    You should either change the family variable in an action and check that or change the global variable and check that.

    you could also destroy the replacemanttiles at start of layout and system compare two values replacementtile1.count = 1 and replacementtile2.count = 1.

    It would be even easier if you made the replacemanttiles 2 frames of the same sprite.

  • Hi LittleStain,

    Thanks for the reply! I tried the suggestions, but I am still unable to get it to work correctly. Could you make the suggested changes and reload the file?

    Thanks again,

    John

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You only have to change two lines

    In the global sheet:

    Instead of blanktile add 1 to tilecount ->

    use system addto variable Tilecount 1

    And in the level sheet:

    instead of blanktiles tilecount = 2 ->

    use system compare variable tilecount = 2

    And it should work.

  • Thanks again, I did get it working, but now I have another question.

    Is there a way to reset the global variables when the page load. I tried both startofLayout ->Set variable(Name)=0 and reset global, and both seem to lock up the tiles.

    I uploaded my working project on the web. The reason I need to reset them is because each page has different blanks and the pages are random. From the online version the complete layer is active because of the global variable therefore, when it recycles pages the layer becomes active. Is there another way to handle it because I think I might be going at it all the wrong way. I am still learning.

    I also updated the linked cabx file from my first post to the new code within the online project.

    Link to online Test Project

    Thanks again for your help,

    John

  • I got it working completely, and thanks again for your help!

    John

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