0 Favourites

How do I drop and check sprite when is in right place

  • Hi, on project i have SpritesA and SpritesB

    SpritesB have own instance variable 'Var'

    Halo of spritesB have this var =1

    You shuld drop spritesA on sprites B with var=1

    when you find all right places to drop game is finished

    can someone help me with this case?

    CAPX fo help

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

  • dropbox.com/s/oh0tb2l5nsufbgc/placeIt%26faceIt.capx

    great example

    hard to understand because its very advanced coding

    can you modify this cap to version without random choose (t0tal) at start?

    i need set this manually

  • dropbox.com/s/oh0tb2l5nsufbgc/placeIt%26faceIt.capx

    hello im back with other question

    How can i reset position of sprites and his variables to start again via events?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Depends on the needs.

    Restart layout

    Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

    Recreate initial objects

    Recreate the objects in a rectangular area of the layout as they appear in the Layout View. In other words, this restores a section of the initial level design. Note that this does not destroy any existing objects, so if used repeatedly will create multiple objects sitting on top of each other. Only objects of the given type are created, or alternatively a family can be passed and all objects belonging to that family are recreated.

    Reset global variables

    Reset all the global variables in the project to their initial value.

    Reset persisted objects

    Across the entire project, reset all objects using the Persist behavior to their initial state (as if the layout has not been visited yet). This is useful when restarting a new game from the beginning again.

  • i should not restart layout

    what you mean recreate object?

    i think on layout should be a button and when i click all object back on start position and should be ready to place all again

    i dont use persist

    thanks

    Depends on the needs.

    Restart layout

    Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

    Recreate initial objects

    Recreate the objects in a rectangular area of the layout as they appear in the Layout View. In other words, this restores a section of the initial level design. Note that this does not destroy any existing objects, so if used repeatedly will create multiple objects sitting on top of each other. Only objects of the given type are created, or alternatively a family can be passed and all objects belonging to that family are recreated.

    Reset global variables

    Reset all the global variables in the project to their initial value.

    Reset persisted objects

    Across the entire project, reset all objects using the Persist behavior to their initial state (as if the layout has not been visited yet). This is useful when restarting a new game from the beginning again.

  • You could do this:

    global number placed=0

    spriteA: on drop

    spriteB: var = 1

    spriteA: is overlapping SpriteB

    SpriteB: pick closest to (spriteA.x, spriteA.y)

    --- spriteA: set position to spriteB

    --- spriteB: set var to 0

    --- add 1 to placed

    --- spriteA: disable dragndrop

    placed = spriteA.count

    --- wait 1 second

    --- restart layout

  • But all should be reseted without restarting all level (because other sprites are in level too, position of player/ killed enemies)

    You could do this:

    placed = spriteA.count

    --- wait 1 second

    --- restart layout

  • Fiddle with 99's other ideas then.

    The most manual way would be to add additional variables that have the original position and variable values in them. Then to reset you set set the positions and variables from that.

  • Well i dont understand the question. I have no idea what you exactly want.

    I notice a question (from 30 may) that implies that nothing is placed on run time. I assume this is still true, that everything is set up in the layout. I have no idea if there are objects destroyed and/or created. How can i, you dont share a .capx ?

    So lets walk trough a few scenarios.

    1/ You want to go back to the basic set up, but want to keep global variables as score ...etc. Use 'Restart layout'.

    2/ You want to go back to the basic set up, and reset the global variables. Use 'Restart layout' + 'Reset global variables'

    3/ Things get created and placed in a random way on layout startup. And you want to go back to to exact the same set up. Assuming that later on objects are created that dont belong to the basic setup. Give each object a instance text variable 'backup' and a instance boolean 'base'. Set base to true for the objects that you randomly create in the setup. Set 'backup' to self.AsJSON during the creation of the setup.

    When you want to go back to the randomly created setup .... loop trough all objects. If 'base' = false then destroy that object, else use 'Set from JSON' to 'backup'.

    Option 1 should be enough though. Explain why it is not what you need ?

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