How do I populate an scene with objects

0 favourites
From the Asset Store
3D Rendered, High Resolution elements to create an apocalytic scene or war zone
  • More precisely, I would like to spawn during runtime ledge helpers and attach them to corners when its possible.

    Also, is it effective memory wise? or is it better to just go old fashioned way and do it by hand when creating levels?

    Thanks

  • shameless bump

  • bump

  • like popup in a tutorial?

  • Have you tried it? I don't expect any performance issues, either way you do it. Just whatever is more convenient for you.

    You can have each of your corners spawn a helper sprite. Or you can put them in a container and use a system-create at x,y to create the corner and helper together. Or you can use a tilemap position of your corner tile to spawn a helper object.

    You're going to need to be more specific, there are a ton of ways to spawn an object. How to do it depends on your situation.

  • yeah, tried it, but either got to spawn just one or one one each corner of every tile. I use an instance variable to determine whether they are right or left but this too didn't work.

    For a better explanation, the last post on my tumblr.

    The big red tiles are one of the sprite frames which is placed in corners. Attached to these ones there's a small helper. I've been trying to do it automatically rather than by hand but with no success.

    http://vertexzero.tumblr.com/post/146506786218/testing-the-flow-during-the-past-weeks-ive-been

  • If I understand, you want the game to automatically detect which tile the player is allowed to hang to?

    That's an interesting question I've also tried to solve.

    Your boxes around the player are to define the hitbox and the "no-grab" zone? It reminds me of an attempt I made myself (but didn't test yet) using "yes-grab" zone instead of grabable tiles, let me fetch some screenshot, and I'll explain...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is that a tilemap? Are all blocks the same or do you have specific corner type blocks, floors, and walls?

  • oosyrag, no is not a tilemap yet but eventually will be. For now since is just a prototype and test bed I use a sprite with 3 different frames so I know which one is for walls, floor and corners.

    Collision is done with a sprite mask.

    Estecka, yeah same I've been trying to solve this but with no success. I read several tutorials that could share same methods but didn't help too much.

    So far I just seem to be able to spawn them in every sprite without taking into account in which frame it is.

  • Glad to be on-topic !

    Sorry I took so long, I forgot my way in.

    Here's my attempt at making a character able to hang to cliffs. Again I didn't take the time to even code it so I only have theory:

    The character is facing right, and is represented by the violet box.

    In order to hang to a cliff, an element of the scenery must be present in the red area on the top right (Detects a wall), but NOT in the green area. (Detects a "hole" in the wall for the character to hang to.)

  • The way I did the my climb is like this, obviously there's some missing code just on top of this for when key is released while grabbing a ledge.

    Also the On Timer "hangTime" in which I set isGrabbing to False as well. That way player can fall from a ledge by releasing a key or by staying too long grabbing one.

    https://www.dropbox.com/s/20c8kb1tgbst3b3/code_01.png?dl=0

    The collision helper I use is called climbDetect, and Player got an invisible sprite attached to it called handDetect. So when one is overlapping the other Player goes to grabbing state.

    Now, since I have to place these ledge helpers everywhere manually, there's more chances of making mistakes, so that's why I'm trying to do it automatically.

  • Mmh, I didn't think my climbing with any sort of helper. Just detecting which areas around the player are overlapping or not the scenery, no tiles would be set as more climbable than others.

    How badly are the helpers needed? I'm not familiar with these so I don't know how they help exactly.

    In the meantime I'll try to put my code into exectution.

  • I doubt they are really needed but it was my solution at that time. Actually I wish I could do it differently lol. the helper is useful since its smaller than the Player controller therefore the overlapping area is smaller. maybe it could be done on code by detecting from an ImagePoint lets say an areaa of 8x8 pixels wide. I don't know how that would work though.

  • Ok so here is a method to spawn helpers for sprite objects. It will work even if every single tile is the same, but will reduce the loops required if your corners are already defined. Basically you check if your block is a corner, and then you check the space to the left or right of each one to see which side is open. Then based on that you will spawn your helper block at the correct position.

    Set up: For your corner animation frame in your block object, make two image points, one in the top left and one in the top right.

    Event:

    For each BlockObject

    Compare Values AnimationFrame is CornerFrame

    BlockObject is NOT overlapping at offset BlockObject.Y+BlockObject.Height (Check to see nothing is above it)

    Subevent 1:

    BlockObject is NOT overlapping at offset BlockObject.X+BlockObject.Width (Check nothing is to the right)

    Action: Spawn HelperBlock at BlockObject's imagepoint top right

    Subevent 2:

    BlockObject is NOT overlapping at offset BlockObject.X-BlockObject.Width (Check nothing is to the left)

    Action: Spawn HelperBlock at BlockObject's imagepoint top left

    Note that for this method if there is a single block by itself, it should spawn helpers on both sides. Up to you if you want that to happen or not. If you don't, you can add an ELSE to the second subevent.

  • For each why I never thought about it.... I should go back to the basics again. Thanks oosyrag

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