vee41's Forum Posts

  • I think the problem, in my case, is that I want the array creation to be more flexible.

    For example, my program currently uses a script to randomly generate the game board. However, the array population function occurs in a different event sheet - the gameplay event sheet. This is because I want to be able to populate an array that represents the board state regardless of how the board was generated (whether through the random board generator or using a pre-created board state).

    However, your approach for populating the array should still work I think. You set the xi and yi values when you populate the array, so I suppose for it's okay in my program to generate the board, populate array, and then set the squares to match certain array values.

    I'll give it a shot using your array population method and let you know how it goes.

    It shouldn't matter whether the squares are generated or preplaced in my example, so it should work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • X-index and Y-index.

    They represent the objects position at the array, so we can use them to index the array position of the square. They kind of link the 'realworld' object positions to the position in the array, this way array knows which squares are around it in each direction. So we can index the square left of square with array.at(xi+1, yi)

    Not the prettiest way to do things, but quite efficient in this case. :)

  • Fixed it, there is always additional space after the dropbox link for some reason :)

  • Here is a bit simpler version:

    Boardgame movement

  • It seems that size of your array is 10, so there are 'undefined' values in the array. That is probably the cause, click on your array object and you can set the initial size of the array at left hand menu. :)

    A bit more 'dynamic' way to do this is set the initial size of the array to 0, and use 'Push to X axis' action instead of set value. That way you don't have to worry about setting the array size manually, as you are basically filling up and empty array so it won't have any blank values.

  • Assuming you have array with text values pushed into it here.

    On button pressed

    .. set text to array.at(floor(random(0,array.width)))

    random(0,array.width) generates a number that we sue to index the array. That number is between 0 and amount of values in the array.

    The floor() around that rounds it down, so we can use it for indexing without going off boundaries.

    The array.at() indexes the array at index defined inside the brackets.

  • Hey Vee, the objects aren't destroyed until the end of the animation, so there is a delay on the combo, as well as using a family for this creates a strange result of the comboX variable to increase indefinitely upon killing the first enemy.

    You could get rid of for each and increase comboX with enemies.pickedcount instead of one. I'd probably tie increasing the comboX to the start of death animation too. :)

  • Not much I can do without seeing the .capx then :)

  • Your exported images are probably too small for your intended use, you should try exporting them in higher quality. Another possibility is that you are scaling them too small, so you could try wider strokes and stuff like that to give them more definition. That way scaling them smaller won't hurt the visual quality so easily.

  • Check that your sprites imagepoint 0 (origin) is where you want it to be.

  • I can't do "on Enemies Destroyed" because each enemy has it's own death animation.

    Why, what is preventing you?

  • Did I hear someone say debugger? No? Ah well..

    Hope you had a great holiday! :)

  • Few methods:

    Create invisible sprite with radius you desire. Spawn it on top of test object and check for objects that overlap the invisible sprite. Now you have all the objects within desired radius picked.

    Another way would be to calculate distance of each object from the tested object and save them as instance variables for those objects. Then pick by comparison, where object.distanceVariable < desired radius. Again, you'll have all objects within certain radius picked.

  • Wouldn't trigger once for each instance be same as:

    conditions

    trigger once

    • - for each object
  • Both should work. Tested and your .capx worked as expected, the new objects are spawned at 0,0. Notice that you got 2 layouts, one with the objects that work (layout 2) and one that is empty (layout 1). Be sure to test in layout 2. :)