iwontnamemyself's Recent Forum Activity

  • DennisR - Have you tried changing the properties in the Physics behavior for the ball yet?

    https://www.scirra.com/tutorials/65/physics-in-construct-2-forces-impulses-torque-and-joints

  • I'm working on a game that is an 8x8 grid of sprites. Each sprite is the same object, just a different animation frame. My goal is to get each row or column of the grid to "slide" on a single axis with a touch gesture according to which sprite is touched and which direction the swipe is. Once a sprite passes through the edge of the grid. It should wrap around to the opposite side, appearing as though each side is connected. When the touch event ends, the sprite should snap to the nearest grid square.

    Right now I have the grid set up, the sprites spawn in the correct position with a random animation frame. The sprites slide when swiped and they snap to nearest grid square when the touch event ends. Any sprites left outside the grid (i.e. the "masking" sprites) are destroyed, so there aren't a numerous amount of invisible sprites lingering around.

    I'm having a problem with the wrapping portion. I just haven't been able to figure out how to accomplish this. I'm using a 2D array to collect the animation frames of each sprite in the row/column at the time the grid is created and then access the array when a sprite is swiped to set the masking sprites to the proper animation frame. It works great for the first swipe. The masking sprites show up in the right places, everything moves according to the initial axis of the swipe. Everything snaps to the closest grid square. But when you swipe another sprite in the same row/column, the original order of the sprites show up again, instead of the new order. Something like this:

    Original order - (masking sprites are regular font and main board sprites are bold)

    123456781234567812345678

    If the sprites are shifted over by one so the row that was shifted now looks like this -

    23456781

    But, the masking sprites of the next touch event look like this -

    123456782345678112345678

    They don't match up. Like I said, I've been trying to use a 2D array to create the masking sprites, so I know I need to shift the index order of the array after every touch event, but I haven't been able to figure out how to do that. Push/pop doesn't do the job and I haven't been able to figure out how to use delete/insert to access the array properly to achieve this.

    The only thing I can think of is to use the 2D array to capture the frames at the time of creation, then use a 1D array to store the animation frames at the time of access, then use delete to remove the old values from the 2D array. Push/pop the values of the 1D array to match the amount of squares moved, then insert the contents of the 1D array into the corresponding row/column of the 2D array. All that just makes me feel like I'm making this way too difficult on myself though. lol

    If anyone knows how to help me use an array to do this, or if anyone has any suggestions to use another method I'm willing. lol

  • rexrainbow - I haven't been able to figure out how to get a sprite to wrap like in your capx by using touch instead of the keyboard. It seems pretty straight forward though, which is why I don't understand why I'm having an issue. Is grid move or slg movement required for the wrap to work? I don't see the layout to board plugin in you capx either. Do we not need that anymore? What's the purpose of InstGroup? It doesn't look life it's set to anything and what is the Chess.Player Boolean for?

  • Thank you so much rexrainbow ! I'm gonna test it once I get home from work.

  • rexrainbow - I can't seem to figure out how to get the logic position to wrap still. I enabled the wrap property of the Board, but when I move a sprite to the first position off the board, it's still showing up as -1, -1 and the position the block should be logically is showing up empty. Also, If I move a sprite to the next logic location on the board, it's showing up as position 0, 0, no matter where on the board it is.

    Maybe I'm just not understanding it, or maybe it's cuz I set up the debugging wrong, so I'll keep working on it...and I guess I'll go through all your .capx again.

  • rexrainbow - I downloaded to new rex_board the other day when you posted it, but I haven't noticed it registering the wrap. I'll see if I can create a new debugging system to check everything though.

    I tried system: create at x, y, and board: add chess, but it wouldn't display the chess on the screen and the debug layout said they weren't there logically either. Like I said though, I'm gonna mess around with it all for a while longer to see if I can get it to work.

    [edit] I figured out what I was doing wrong when trying to create the new chess. I was using the logic position instead of the physical. lol [/edit]

  • rexrainbow - Is there a way to create chess outside of the Board boundaries? I'm back to thinking a mask would be the way to go. Currently, I have 2 projects working, one using your Board plugins and one without. On the one without, I'm able to create chess outside of the board area, but I'm unable to figure out how to achieve this with the Board plugin. Do you know of a way to do this? Or do I need to make the Board bigger and create the chess only in the middle so I can have tiles for the new ones to spawn over?

  • rexrainbow - Do you think there will be a way for me to get it to look like the sprite is wrapping pixel by pixel?

  • There is still one bug, but I don't know why it occurs and how to fix it. It happens when I touch Red (for example) and then drag it, it seems that it isn't dragging but when I touch Green (still holding first touch),the Red one jumps to that position where I'm holding touch.

    VerteX123 - How did you fix this bug? I'm having the same issue with my game. The drag doesn't start working until the second touch for some reason. I've tried using Is In Touch, Is Touching Object and On any Touch Start and they are all producing the same bug.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rexrainbow - If it's possible, on a 10x10 board, the physical wrap should begin once sprite.x + sprite.width begins to pass through the (0,9) (0,10) boundary and start to appear at the (0,-1) (0,0) boundary. It would appear as if the sprite was in both locations at the same time. Once the origin of the sprite enters the (0,0) location, then the logic position changes from (0,9) to (0,0).

  • rexrainbow - So I'm reluctantly coming to the realization that using a masking system to duplicate the sprites for each row/column is the way to go, but I just haven't been able to get it to work with your Board plugin logic, even with your LogicPin behavior.

    I'm wondering if you know a way to duplicate an entire row or column of a Board object and place the duplicates on each side of the Board location. To look something like this onedrive.live.com/redir where blue is the main Board and pink are duplicate rows of the main Board object.

    I think that may be the only way to produce a wrapping effect for a short distance in either direction.

  • Awesome, Thanks rexrainbow

iwontnamemyself's avatar

iwontnamemyself

Member since 10 Nov, 2013

None one is following iwontnamemyself yet!

Connect with iwontnamemyself

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies