How do I swipe screen left to reveal sprites outside of view

Get help using Construct 2

Post » Fri Apr 03, 2015 12:38 pm

I have a layout with a background image.

On top, I have a layer with images which I want to be able to swipe left which reveals more images. I have no idea how this would be done?.
Any ideas/suggestions?.

Image
B
4
Posts: 19
Reputation: 238

Post » Fri Apr 03, 2015 9:35 pm

I've done this before by using a large sprite with the dragDrop behavior to move it, as well as the pin behavior for the other sprites to attach them.

Then also one or two events to limit how far you can drag the sprite. Something like
Sprite x < 0
--- set sprite x to 0

Sprite x > 640
--- set sprite x to 640
B
85
S
27
G
77
Posts: 5,004
Reputation: 53,742

Post » Tue Apr 07, 2015 11:30 am

Thanks but not sure it's going to work for exactly what I need.

So far I've added a background sprite which does nothing. I then created a new sprite which is the same height as the layout, but slightly longer. I modified the collision polygon to bounding box. I then added a drag drop behaviour to it for horizontal only.

This works well - I can swipe the screen beloe the level thumbnails and the levels will move to the left, revealing more levels. But - since it uses a single sprite, I am unable to work out how the user can select a single level to take them to a new layout. Because it is one big sprite, everything gets selected.

Really stuck with this - someone must have an idea?. Can parallax be used with this?.

Image

Edit: Just found this and it's similar to what I need, this example is from another tool though.
https://www.youtube.com/watch?v=6IoRGjpqhfs
B
4
Posts: 19
Reputation: 238

Post » Tue Apr 07, 2015 4:46 pm

The level rectangles need to be pinned to the sprite you drag and then you can give the rectangles a variable with the name of the layout to go to, which you can use with "go to layout (by name)"

https://dl.dropboxusercontent.com/u/542 ... lide2.capx
B
85
S
27
G
77
Posts: 5,004
Reputation: 53,742

Post » Tue Apr 07, 2015 6:36 pm

Hi,

Thanks this is almost exactly what I need. The problem is the background sprite/image needs to be still. It works fine for a solid color background but using a a picture/image instead moves the picture as well as the levels.

How to get round that?
B
4
Posts: 19
Reputation: 238

Post » Tue Apr 07, 2015 6:44 pm

Use a separate sprite that is invisible.
ImageImageImage
B
71
S
19
G
165
Posts: 3,425
Reputation: 95,561

Post » Tue Apr 07, 2015 7:25 pm

..and simplest way to "align levels" on Drop?

from this..
Image
to
Image


Edit: something like this...but with less events...

capx:
http://s000.tinyupload.com/index.php?fi ... 9900497497

Thanks!
Image
B
59
S
23
G
7
Posts: 1,450
Reputation: 10,614

Post » Wed Apr 08, 2015 12:06 pm

Thanks R0j0, blackhornet and korbaach,

Had plenty to play about with, for some reason cannot get OR blocks to show up, read up and doing everything right but they wont show?. Anyway really liking that Korbaach and I've began to base my own off your version.

But for some reason the invisible slider will not move/slide after it's been swiped left for a little bit. After a certain point it will just move the slider. Been messing about with it for some time but no joy

Image

I've attached a capx file too...

http://inspiredappdesign.com/test.capx
B
4
Posts: 19
Reputation: 238

Post » Wed Apr 08, 2015 1:25 pm

@chewz
..you need to set "roller" origin point x=0...

capx:
http://s000.tinyupload.com/index.php?fi ... 8965697697
Image
B
59
S
23
G
7
Posts: 1,450
Reputation: 10,614

Post » Wed Apr 08, 2015 4:12 pm

Thanks, appreciate it.

Don't really understand it though. Set WWidh to WindowWidth?.
B
4
Posts: 19
Reputation: 238

Next

Return to How do I....?

Who is online

Users browsing this forum: Mayfly and 8 guests