oosyrag's Forum Posts

  • On all objects, add a "type" instance variable. On creation of any object, set the variable to object type. Now when you pick by UID, you can look up self.type by expression.

    ... maybe? Just an idea.

  • Although I am an huge fan, I do feel Scirra could put a little more effort in keeping tabs on community projects and their progress, and by extension keep their showcase updated.

    Or it could be the matter of relative difficulty exporting finished products which has been discussed often.

    I find it more likely that successful long time C2 developers are busy being successful, rather than promoting the engine they work on. I imagine for the developer making the blockbuster there is little incentive for them to promote the engine they created their product on. It falls back to Scirra to promote the success stories.

    On the other hand, Scirra may be making enough from licensing and the store to not even care about pulling in (and supporting) more users, and focus on C3 instead. It all comes down to economics and incentive/motivation.

    Edit: PS - There are actually many more reasons for people to want to NOT show the "Powered by Construct 2" splash screen, given that they are not REQUIRED to, unlike some other big name engines like Unreal ect.

  • Ah ok now I understand, thanks. For the other solution, object count was going insane, so I fixed it by adding on Start of Layout. I might go deeper into your solution after so I can have a better control ( and understanding) of it. I'm still trying to figure out why it worked with new sprites rather than old ones. had to adapt my events to it.

    *Actually is because I set in the sprite properties Collision to Disabled, then it spawns helpers on every one of them since it no longer detects overlapping. I was using a small sprite of 4x4 pixels that I scale up to use as collision since it reduces collisions.

    I'm going to try and adapt the same to this mask instead, or is there any better way to do this?

    Right sorry about that, normally I would put something like this in a function to call on start of layout, or to update during runtime by trigger in case your blocks can move and you need to reposition the corner helpers.

  • https://www.scirra.com/tutorials/37/beg ... onstruct-2

    https://www.scirra.com/tutorials/253/ho ... tform-game

    These are the best beginners tutorials. If you go through them, you will be well on your way to making games.

    As for videos, check out the C2 Academy channel on Youtube.

    https://www.youtube.com/playlist?list=P ... 6HHrKJi95r

    I myself have no patience for videos, so unfortunately I don't have a recommendation on which video may be the best to start with, sorry!

  • Didn't get a chance to check out 99's solution since I'm not on latest beta, but here is one working to my satisfaction. It uses the spawn helper itself to check for open spaces around the blocks, then moves them to the correct image point.

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

    This bypasses the issue where adjacent collision boxes count as overlapping (the helper sprite is smaller than the block sprite), and you don't want to shrink the collision box on your block because you need it for your platforming behavior.

    Pseudocode:

    For each block, check if space above is empty with a helper.

    If it is not empty, destroy helper sprite (and try next block).

    ELSE if it is empty, destroy the helper above

    Then make a new helper to the left of that block and pick all blocks to check collisions.

    If collides, destroy that helper. Else, move it to the corner.

    Repeat with a helper to the right of the block.

    By the way, this should totally work if you manually set instance variables defining left/right corner, so I'm not sure if you're interested in troubleshooting why that wasn't working. The method I'm using right now is meant to save you the hassle of manually setting corners (as variables) in case you have a large level in the future.

  • It seems like when you have object bounding boxes directly adjacent to each other they count as overlapping, so this solution might not work as I expected to at all. Gonna think of another way. But don't worry, I'm sure it can be done

  • Here you go. I got to experiment a bit and realized I left out the Pick All. Originally when you do For Each, only the active block is picked, so when you check if its colliding with any other blocks around it, it wouldn't because the only instance it sees in that event is the currently active one unless you use Pick All.

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

    Not quite finished, as you can see with the one at the bottom of the U, but hopefully it will get you going in the right direction.

    Edit: Still broken in several situations, I'll try to refine it a bit...

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

  • Is that a tilemap? Are all blocks the same or do you have specific corner type blocks, floors, and walls?

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

  • Run a loop with a variable counter 50

    While counter > 0

    Pick random spot

    If spot is NOT within minimum of distance of tree - Place tree at spot, reduce counter by 1

    (if it is too close to a placed tree, the event will run again without reducing the counter and pick a new spot to try)

    Edit: Depending on the availability of space for placement, this can be a very inefficient method. If there is not much space left for that last tree, it might loop a ton of times before randomly hitting that spot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Arrays can store strings too. It doesn't have to be a number.

    You'll definitely want to get very familiar with arrays and array manipulation if you are doing a card based game.

  • Helper sprites are always useful and usually the quickest, simplest solutions.

    For a event only version, you would be saving the Touch position to a variable On Touch, and comparing that to the current Touch.X position. With the condition Is In Touch, you can use Scroll to X where X is the difference between scrollx (current screen position) and Touch.X-OriginalTouch.X (length of drag). Depending on where scrollx ends up closest to, you can then set the Scroll to X to the appropriate screen On Touch Released. To get things smooth, lerp can be used as well.

    But yeah I would definitely recommend just sticking with a helper sprite as long as you are satisfied with the result.

  • It sounds like you want to use containers.

    Put the Text Object in a container with the Turret Object. When you create the Turret object, it will also create a Text Object that you can then set the text to.

    The result of this is whenever that Turret Object is picked, such as On Bullet Collide with Turret, the associated Text Object will be picked as well, so you can do Set Text to Visible.

  • Manually positioned animated sprites. Assuming you are not using unique tiles/animations, you only have to load the animated sprite into memory once for all instances of it.