AM2000's Forum Posts

  • I'm making an infinite scroll type game using tiled background. The tiled background goes up when the player is going up and down when player is going down and remains static when the player is not moving. So how can I spawn sprites (not in static way) when either the player is going up or down through the tiled background?

  • I have a grid and want to spawn sprites randomly and are not overlapping each other. But once in a while, one, two or even three sprites overlap even though I destroy the sprite they are spawning on. Any advise?

    Trigger Once

    pick a random instance of SP1 &

    SP2Family is not overlapping on SP1 : spawn SP2(turn left) on SP1

    : destroy SP1

    Repeat 2 times

    pick a random instance of SP1 &

    SP2Family is not overlapping on SP1 :spawn SP2(circle) on SP1

    : destroy SP1

  • Okay, thank so much!! Also, just asking, it is better to leave the layout empty and create every stuff in the ES or lays sprites on the layout and set accordingly?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 2nd option but in a opposite way. 5 instances of the sprite in locked location and rest 2 sprites instances placed randomly. Is it possible without using arrays?

  • I'm using the arrays because I need to randomise the locations of those sprites which are not in 2nd array. 2nd array sprites just need to be in the static location in the 4x4 grid, other sprites need to be randomly placed.

    Any way to randomly create the sprites without using an array but with that 4x4 grid? Also, if the comparison is false, how can I spawn other sprites.

  • One thing more, I need to create the remaining sprites which is not equal to the 2nd array elements. Basically, it should be like, if SpriteA compare Variable != array2.CurValue: create spriteC on SpriteA where X = SpriteA(loopindex).X, Y = SpriteA(loopindex).Y

    But it is spawning 315 spriteC everywhere, so instead of that, I wrote.

    X = (SpriteA(loopindex) <> array2.CurValue)).X

    Y = (SpriteA(loopindex) <> array2.CurValue)).Y

    and that is still creating 315 spriteC but now on only one correct location.

    Need to create the spriteC on remaining spriteA. Should I set up the spawners on the layout screen?

    Help would be appreciated!!

  • Many thanks, it worked!! I thought that running the entire stuff on start of the layout may be better than bringing stuff on the layout itself.

  • Also, if the comparison is true, coordinates from 1st array will be used to create the sprite.

  • I've made 2 arrays, one stores the coordinates of all the sprites contained in the grid(so 16 coordinates stored). Other one contains the IID's of those sprites on which certain sprites need to be created(Those sprites have different behaviours). Also, if the array's element(2nd array) is equal to the instance variable(note that the instance variable is different for every instance of the same sprite), that certain sprite will be created. So I need to iterate through the 2nd array and instance vars of the sprites to made the comparison. I'm using for each but I'm getting the infinite loops.

  • There is a grid of 4x4 and I've set the instance variables to the IID's. Like 1st sprite IID is equal to the instance var of the same sprite(1st sprite IID(0) = instance variable(0), 13th sprite IID(13) = instance variable(13). And there's an array having elements, so if the instance variable is equal to the array's element, a sprite will be created.

    So, how can I iterate through the instances and what should I compare them with?

    Help would be highly appreciated!!

  • Thanks!!!

  • So I've got 2 arrays, one is storing all of the coordinates and the other one is storing IID's of all sprites(it is a 4x4 sprites grid). How can I match the index of the first array to the IID's stored in the second. Also, how can I create the sprite if the conditions meet as the create option requires the X and Y axes and I need to create the sprites if the index and the IID are equal(index and co-ordinates are stored in the 1st array)? Like if the condition matches, the sprite will be spawned on the co-ordinates

    Tagged:

  • I'm creating a puzzle type game in which certain sprites are being created on the start of the layout. So in that, there are 2 arrays, one stores all of the coordinates(on which all of the sprites will be spawn) present in the layout whereas the other one stores the co-ordinates on which certain sprites will be spawned. My question is, how can I create the sprites on the co-ordinates stored in the 2nd Array?

    Tagged:

  • You can do like this example: dropbox.com/s/7cwh6xxz6ms9epw/match_by_swap.capx

    Thanks for the file but there's no family. Need to get the family's members for that.

  • So, I'm making a game in which there is a grid of 3x3 and the user needs to create a route by swapping sprites which lead to the objective. But the question is how can I swap the sprites as the they all are the members of the same family? I've tried the picking up the sprite by overlapping of the mouse coordinates but how can I swap them, storing the variables in temporary global variables and then setting the position of the sprite should be there, but I need to do it using family else there would be so much of events just for swapping. Any help would be appreciated?

    Like:

    on family drop:

    is overlapping same family:

    pick instance overlapping mouse.x and y: set glob var x to overlapping sprite.x

    set glob var y to overlapping sprite.y

    set position of dragged sprite to temp x and y

    set position of overlapped sprite to var x and y.

    Refinements would be appreciated.