Laurent's Forum Posts

  • There ya go : dropbox.com/s/g6vk2edgy81lmrw/spritecoordinatearray_edited.c3p

    edit : ok I see you want to spawn the sprites instead of flash, well use my logic and instead use create sprite action and also an action of set ID to the tokenat value displayed in the condition at line 9

    Thank you very much !! I managed to adapt your tip to create sprites.

    Here's the file, if it can be useful to anyone : https://www.dropbox.com/s/oaq41k1xn2fuw0m/MapFromJson.c3p?dl=0

  • My approach would be to have the next instance variable with all the instance IDs so it could be "1,2,3" then you could use the tokenat expression to grab individual numbers, and use a loop to run through each picked instance. If you can't work it out maybe I can add to the project file if I have time.

    Thank you ! Indeed, it's beyond my skills. Actually, this loop approach would be to allow to spawn more than one instance when a sprite is clicked. for example, when sprite with SpriteID = 1 is clicked, create instances with SpriteID 2 and 3.

    I updated the file here : https://www.dropbox.com/s/3b7b6q09kuwkybx/SpriteFromArray_Test.c3p?dl=0

  • You could either pick all sprites again using system pick all and then use your pick condition (within the same sub event) or you could use a function and pass the values through as parameters to pick the correct sprite.

    Thank you ! I managed to do it following your first suggestion but I'm very curious to see how you would code the second one.

    Any idea on how to code link to multi instances ?

  • I'm building an engine to populate a layout with instances by using an array that contains instance X and Y, opacity, visibility, etc.

    Instances are connected between them and array also contains their connections in a way that if I click on an instance, the related instance will flash. This is determined by the column called Next in the json. In this case, Instance 1 flashes Instance 2, Instance 2 flashes Instance 3 and

    Instance 3 flashes Instance 1.

    So far, I was not able to build this connection between sprite. My attempt is line 5 and 6 of the code.

    I'll be grateful if someone could help me with this.

    Also : I'd like to have more than one connection between instance. For example, instance 1 when clicked flashes instance 2 and 3. I thought about populating the array with strings like "2,3" but don't know how to parse them.

    C3p can be found here https://www.dropbox.com/s/lyvoap25so4bs6p/SpriteFromArray_Test.c3p?dl=0

    Tagged:

  • It perfectly does the trick. Thank you !

    Thank you, in the later videos I have increased the Construct font size to show better what I am writing.

    For your issue add a sub event, if sprite is visible, then Array.at(X,Y,Z) = 1, else 0.

    That should do the trick.

  • Thanks! I will subscribe to your channel :) point is I have a 13' laptop and it's very difficult to read the writings on the screen.

    BTW, Something else I need to do : in my array, I stored values like coordinates and opacity. But I'd like to store booleans to define sprite visibility. I tried using 0 and 1 but visibility is only a matter of True and False. How can I test 0 and 1 within my loop and turn it into False/True ?

  • I was wondering, In my array, I stored values like coordinates and opacity. But I'd like to store booleans to define sprite visibility. I tried using 0 and 1 but visibility is only a matter of True and False. How can I test 0 and 1 within my loop and turn it into False/True ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > I think I get it : Sprite #0 is sprite i did put myself on my layout on the editor. I removed it and everything is fine now !!

    Well, you typed faster than me :D

    You've been of great help BTW :)

  • I think I get it : Sprite #0 is sprite i did put myself on my layout on the editor. I removed it and everything is fine now !!

  • Thnks

    My array has 4 rows numbered from 0 to 3.

    I did what you wrote, from 0 to TabHeight -1 and its removes the last sprite on 0,0.

    But I still have this first hidden sprite #0 outside the layout at 580x-157 which are coordinates that are nowhere to be found in may array.

  • Thank you dop2000 !

    I did this and no more infinite sprites are created. But this time, 4 rows are detectect in there array, as it should be, but 6 sprites are created, #0 in a location outside the layout I can't understand, and #5 at point 0,0. I can't explain this. #1 to #4 are correct

    Here's a screenshot and c3p has been updated

  • Hello

    I'm trying to automatise the creation of a layout by using an array to store sprite coordinates and frame number.

    Here is how it works :

    - coordinates and frame numbers for sprites to display are stored in an array

    - loop fetches coordinates from the array to display sprites

    - loop fetches frame number to change sprite appearance

    Everything works fine except that loops continues to create new sprites every click at point 0,0 and I can't understand why..

    Any idea on how to fix this ?

    Construct3 file is here :https://www.dropbox.com/s/hb5wwyz13oikfyb/SpriteCoordinateArray.c3p?dl=0

  • Thank you dop2000 !

    So, my variable in classic Construct Event sheet wil be 'd' ?

    As for not working on Safari, I used it to generate a value to check if we were in a given month (true/false) and it worked as if false was always returned regardless it is the case or not.

    Same test did work on Chrome but not in Safari.

  • I have a variable in my Construct project called Month and I would like to give it the value of the current month using javascript method w3schools.com/jsref/jsref_getmonth.asp

    How can I do that ?

    I know there is now a Date object in Construct 3, but somehow, it doesn't seem to work with Safari

    Tagged:

  • That was fast !!

    Thank you so much ! Easy but syntax is a bit tricky