Laurent's Recent Forum Activity

  • > construct.net/en/forum/construct-2/how-do-i-18/simple-scorched-earth-worms-129595/page-2

    Unfortunately that method doesn't work in C3

    Damn ! We're doomed...

  • Hello

    I try to create an engine that will allow me to build tilemaps from a bitmap. I think it will be an easy and memory friendly system to store tilemaps.

    Thanks to calminthenight, I managed to adapt this little engine that works this way :

    - create a bitmap on transparent background where every pixel represents a tile in the tilemap

    - paste bitmap in canvas object, take a snapshot

    - scan the snapshot line after line ans check certain color (in the current example, I scan only for red pixels, i.e. where DrawingCanvas.SnapshotRedAt = 62)

    - create related tile at same coordinate in the tilemap

    The system logic is ok but it seems there is a viewport scale issue, i.e. when my original bitmap is 10x10 pixels, its size changes according to viewport scale when layout is displayed. So the created snapshot could be bigger, a 1x1 pixel could become a 2x2 pixel and the tilemap is not correctly created. Here is the original file : https://www.dropbox.com/s/p4my3kk4tcihbk2/MapFromPixelSprite.c3p?dl=0

    Following are two screencap showing how thinks show on screen at different viewport sizes and the image of the original sprite.

    Tagged:

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Laurent's avatar

Laurent

Early Adopter

Member since 18 Jan, 2012

Twitter
Laurent has 1 followers

Trophy Case

  • 14-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

19/44
How to earn trophies