move objects in array / Delete all indices above x

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Uh, can you tell me what I am doing wrong here?

    I am destroying a few cubes, the objects avoce should fall on the position of the deleted cubes and the indices with no objects should be empty but somehow that doesnt work.

    (and somehow they stack on eachother or fall below the grid...)

    -----

    additional info:

    function "falling": looks for the cubes above that and moves it down.

    x/y - position of

    z0: frame of the cube where it looks for the adjacent cubes

    z1: uid of cube

    z2: destroyed 1 / undestroyed 0

    Time21.capx

    It should be quite clear if you download the capx

    Yours

    Black2key

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've been looking at your .capx and thinking about what you're trying to accomplish, and I think that you need to compose a special Delete Function in the events sheet. This Delete Function would shift the elements towards the end of the array in the Y dimension when an element is deleted. So in your case the Y dimension of the 3D Array is one of those vertical columns of Cubes. And when the Cubes are deleted and there associated coordinates in the Array Plugin have the value set to 0 in the 3rd Dimension, you could have the Delete Function shift all the existing cubes that are displayed above each deleted cube shifted down by 1 in the Y dimension. I'll try to make amendments to your solution to achieve this idea, when I get the chance. But for now hopefully this idea might help you.

  • Hey, Black2key! I have Capx that is a solution to your problem. I've tried my best to make intuitive modifications to the Event Sheet. I had to modify your Mouse Click Event Group and fully re-write the "falling" function. I put as many comments as I could in. I hope that the comments make sense, and that they will help you understand the logic of the "falling" function.

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