Pulstar's Recent Forum Activity

  • this sounds good but if put in

    array.indexof(emptyvalue)

    wouldn't the items just get set to going into slot 1 even if there is an item there.... seems like i need some setup to check which slots have items and which are free

    How do mark a slot as empty now? If you have not filled your empty array of size(x,y) with anything there should be a "0" in every empty slot. Look for that 0 with array.indexof(0) and you are good to go. You can also mark empty slots differently, if you want to mark some item with the number 0. But then you would need to fill the array with that value on creation and be careful that only runs once when a new game is started and not on layout start or anything (switching layouts would then delete all values from the array). 0 is a safe bet.

  • Plug whatever is the value in an empty slot in your array (I assume you use 0) into the "indexof" expression of the array object like so:

    array.indexof(emptyvalue)

    This expression will return the index at which the first X axis element matching the criteria is. Or -1 if an empty slot is not found. So in your case you will get the number of the first empty slot, in which you can put an item. Or if the result is -1 you can do some kind of "inventory is full" message.

  • The shattering into pieces part can be done by destroying the crate on collision with the bullet and creating crate bits at its former position.

    Overall you need to store the bullets angle on impact and just apply it +/- any random angle offset (to get a cone effect) to newly spawned crate pieces, which should have bullet behaviour. You can also randomly set their speed and accceleration (negative to slow down!) to give the impression some are heavier and some are lighter.

    Here's an example. The simple square cratebits sprites could be changed for actual fragments of your crate sprite, you could do multiple frames for the crate bits, disable the animation by setting the animation speed to 0, and upon creation assigning a random frame.

    https://www.dropbox.com/s/3vluoo10v8ncp ... .capx?dl=1

  • On hole creation assign each hole a unique ID value (or you could just store their IID, I prefer to use my own ID variables rather than the system ones). Store it (push back) that value as a new array element at the X axis, in an array with a default width of 0 and a height of 2. After all holes are created, assign a random number for each X array element at Y=0 (Y=1 will still store your Hole.ID). Sort that array by axis X (it will sort only by values at Y=0, so the random ones) and create objects in a loop that goes through the first three elements and picks each hole by the ID stored "array.at(loopindex,1)".

    The below example will work so long as you have just 3 colours. If you want to pick 3 random colours out of a larger set of colours, things will be a bit more complicated (personally I would do that with yet another array).

    https://www.dropbox.com/s/kv8uhun8anyjo ... .capx?dl=1

  • There is also interactive (adaptive) sprite/tilemap example for level editor:

    Yes, but it does not show the "drag to show positions before creating" mechanic used commonly in strategy/simulation games for building roads or walls (which the OP wanted to know how to do), such as that found in Rimworld, SimCity and the rest mentioned by the OP. You end up with lots of "accidental" wall/road tiles the way that example works and that is just annoying for the end user.

    It is still a very cool interactive example for bitwise auto-tiling though and the tile creation method is sufficient to show how auto-tilign works.

  • Kazan I found a fairly simple way of doing this for an isometric grid, probably far simpler than my original solution. It involves drawing a ray for overlapping tiles. It is possible to make "rigid" directional dragging by setting the ray's angle to the closest "approved" angle based on the one calculate from angle(mouse.x,mouse.y,buildcursor.x,buildcursor.y), so that walls only go along a straight line perfectly aligned with isometric grid lines.

    Might do a tutorial on this in the future. Could be useful if somebody wants to do a level editor.

    https://www.dropbox.com/s/au5wupgkvwdbx ... .capx?dl=1

  • Look at the "set position to object "hole" action. That whole event is not picking any hole in particular via the conditions. Construct 2 events work sometimes in a way where the first instance of an object is picked for an action when meeting event conditions*. This is why Tuiii wrote you need to add a "system: pick a random instance" condition to it. Add it under the "For "create x objects" condition and it should work.

    Edit: *for some actions where the engine expects to use just one object instance instead of multiple from a picked set.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I didn't mention it in my original post because I didn't want to bog it down with details but I am indeed trying to make something like this work with an isometric grid So yeah, this will take some research and study. This is a great help.

    Again, thanks. Appreciate you taking the time to help

    No problem. I might throw you an isometric grid solution today after I get back from work. I have a fairly good idea to do it, as outlined under the EDIT in my previous post.

  • I think it would be simpler to ditch turret behaviour altogether in your case, have each facing direction as an animation frame (or separate animation) which you switch depending on the angle calculated between the target's position and the turret's position.

  • I did something like this long ago, when I was ambitious and dreamt to clone Dwarf Fortress, in Space (this was a few years before Rimworld, back when I first toyed with the free version of Contruct 2). The good thing that came out of that foolish quest was learning how to do construction UI and how to use arrays to store jobs/orders for multiple units such as resource harvesting>go to stockpile when full>go harvest some more (with finding idle units and prioritizing them at that). Also I did some wall auto-tiling, fun times.

    The trick is to use a tiled background (unless you are using anything other than a square grid) for the build cursor*, but set its position to the grids used by your tilemap by calculating the closest grid-aligned position (gridsize*round(mouse.x/gridsize)). You stop the cursor from following the mouse when the button is held and you set the width and height as a multitude of your grid width/height depending on mouse position versus build cursor position. Once the button is released, you calculate the direction and number of walls to be generated and plug the values into a wall creating loop.

    https://www.dropbox.com/s/1njelck019iqk ... .capx?dl=1

    EDIT:

    *For other grid shapes, including isometric or hex, things get trickier. In such cases you would need to dynamically spawn wall section cursor (ghost) sprites when dragging along a given axis. Or, if you are feeling clever, you could create the maximum visible number of such sprite, index them from 1 to whatever, and set them to invisible by default. Then, whenever dragging is on, you would arrange as many sprites as needed along the line that has been dragged and make them visible after they are positioned. Once dragging is finished you make the invisible. Less messy than creating/destroying ghost wall sections all the time.

  • Create a variable for kills to next level.

    On Enemy destroyed> add 1 to kills.

    kills>=kills to next levels then add 1 to level, wait 0 seconds, subtract kills to next level from kills, wait 0 seconds, add 2 to kills to next level.

    I added the kills and other variables to the player object.

    Probably should add the system condition "trigger once while true" to the kills=killstonextlevel event.

    https://www.dropbox.com/s/t33wvsdkahh60 ... .capx?dl=1

  • Did you make sure the mask is on the same layer and that the layer has force own texture set to true? Please note that these blend modes do not show in the editor, the effect is only visible in preview.

    Also z-order of the mask is very important.

    Edit: set opacity to 0 the mask's. Very important!

Pulstar's avatar

Pulstar

Member since 10 Jan, 2016

None one is following Pulstar yet!

Trophy Case

  • 8-Year Club
  • Email Verified

Progress

9/44
How to earn trophies