Move pinned objects?

Get help using Construct 2

Post » Sat Sep 27, 2014 6:07 am

I have a grid full of sprites (I'm using Board, LayoutToBoard and SquareTx) and I need to move an entire row of sprites in a single touch swipe. I have a translucent place holder sprite on the layer above these sprites that covers the entire row and when I pin it to the sprites below and try to move it, some of the sprites end up off track and overlapping, while others just disappear.

What I have right now is:

For each Sprite1
--Sprite2 Is overlapping Sprite1 -- Pin Sprite1 to Sprite2

I've tried all of the Pin to mode options and it's the same outcome each time (excluding the angle only option). I've tried making the sprites a little smaller, so they don't collide when moving. I've tried moving all pinned objects forward one level. All to no avail. (Besides the fact they only let us have 4 layers in the free version) :(

Am I going about this the wrong way? Is there an easier way than having a marker sprite? HEYLP! lol
B
10
S
1
Posts: 67
Reputation: 909

Post » Sat Sep 27, 2014 7:39 am

could you attatch a capx. I personally am having trouble following the question. capx would help see whats happening.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Sat Sep 27, 2014 4:48 pm

NP @Tylermon :) Sorry about not explaining it well. I'm not really sure how else to explain it. I have a feeling I'm making things a little harder than they actually are for myself. lol

[edit]switched the .capx[/edit]
You do not have the required permissions to view the files attached to this post.
B
10
S
1
Posts: 67
Reputation: 909

Post » Sun Sep 28, 2014 8:12 pm

If I removed the "Slider" sprite, would things be easier? Would I be able to move the entire row at the same time?
B
10
S
1
Posts: 67
Reputation: 909

Post » Sun Sep 28, 2014 9:59 pm

I cant open the capx sadly because I dont use many of the plugins you have.

That said, I made two sprites. Made one a drag and drop sprite.
Pinned a bunch of sprites to it and shook the thing like crazy.
I cant get my pinned sprites to get misplaced no matter how hard I try.


You mention you use multiple layers. So I am thinking, if you move on one layer, that layer may have different x,y locations than the other layers. Trying to move sprites on different layers may be causing your issue.

Do you use parallax or anything? are the layouts/layers the same size.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Sun Sep 28, 2014 10:52 pm

Yeah, I've been using a lot of @rexrainbow 's plugins and behaviors. They are extremely useful!!!

Basically, the .capx contains a 1 x 8 grid with a sprite in each grid square, eventually it will be 8x8. There is a long rectangular sprite that appears on top of the row once the screen is touched, which will eventually be clear, but for testing purposes I want to be able to see it. With this "slider" sprite, I want to move the entire row of sprites from side to side using touch controls. Then once I get this part working, I need to figure out how to get the sprites to wrap at the edges of the board, at the pixel level, so you can see the sprites at the edges on both sides of the grid when they crossover.

At one point I was using multiple layers, but I found that if I just set the solid behavior of all the sprites to disabled, I don't need to use multiple layers.

With that said, I tried using drag and drop before. I guess I just don't know it well enough to get it work. But, by the looks of the conditions and actions it provides, the functionality I need just isn't there. Right now, I am using a for each loop to pin all the sprites to the slider sprite, but it's just not working. I'll goof around with drag and drop some more though and look up the tutorials again.

I haven't tried using parallax yet. I don't know how I would get it to work along with the wrap, since I'm not wrapping at the edge of the layout. Is it possible to view multiple layouts at the same time? That would make things a whole lot easier cuz then I could just set the board layout to the size of the board and have the UI stuff on the sides on another layout beneath the board. lol
B
10
S
1
Posts: 67
Reputation: 909

Post » Sun Sep 28, 2014 11:27 pm

Pin the sprites to the translucent sprite, then move the translucent sprite with drag drop. That should work fine.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Sep 29, 2014 12:39 am

iwontnamemyself wrote:Yeah, I've been using a lot of @rexrainbow 's plugins and behaviors. They are extremely useful!!!

Basically, the .capx contains a 1 x 8 grid with a sprite in each grid square, eventually it will be 8x8. There is a long rectangular sprite that appears on top of the row once the screen is touched, which will eventually be clear, but for testing purposes I want to be able to see it. With this "slider" sprite, I want to move the entire row of sprites from side to side using touch controls. Then once I get this part working, I need to figure out how to get the sprites to wrap at the edges of the board, at the pixel level, so you can see the sprites at the edges on both sides of the grid when they crossover.

At one point I was using multiple layers, but I found that if I just set the solid behavior of all the sprites to disabled, I don't need to use multiple layers.

With that said, I tried using drag and drop before. I guess I just don't know it well enough to get it work. But, by the looks of the conditions and actions it provides, the functionality I need just isn't there. Right now, I am using a for each loop to pin all the sprites to the slider sprite, but it's just not working. I'll goof around with drag and drop some more though and look up the tutorials again.

I haven't tried using parallax yet. I don't know how I would get it to work along with the wrap, since I'm not wrapping at the edge of the layout. Is it possible to view multiple layouts at the same time? That would make things a whole lot easier cuz then I could just set the board layout to the size of the board and have the UI stuff on the sides on another layout beneath the board. lol



You dont need a for each loop.

Just say pin Sprite to sprite and all of that sprite gets pinned.

Generally for each is useful when you want to do more specific things.
Like check a variable.
It helps pick only certain objects instead of all of them.


Maybe the grid object or something you are using is what is breaking them? is it possible one of your plugins is trying to keep the objects in a certain spot, but the slider/pin behavior is conflicting so the two sort of fight each other making a giant mess?
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Mon Sep 29, 2014 1:43 am

@Tylermon When I do that, it pins all the sprites on the entire grid. I need it to only pick one row or column, which is why I was trying the for each loop.

@codah That doesn't work when there are multiple rows on the grid though. It'll pin everything on one specified row when before runtime, but that's not what I'm looking for. I need it to work on a multi-row grid when the user swipes a row or column.

Here's my full .capx so you can see what I'm talking about. In this version, it enabled dragdrop and took out the for each loop to try some other ways, but I haven't been able get it yet.
You do not have the required permissions to view the files attached to this post.
B
10
S
1
Posts: 67
Reputation: 909

Post » Mon Sep 29, 2014 3:33 am

Ok, I got it. I ended up having to make a collision condition between the blocks and the slider and now the pin works.

Thanks for your help @Tylermon and @codah :D
B
10
S
1
Posts: 67
Reputation: 909

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests