How do I make slide effect?

Get help using Construct 2

Post » Sat May 07, 2016 8:05 pm

Hi,
I would like to make a slide effect to a mobile game. It's not a just regular slide, this includes sliding an object in a bit angular way. Please check the below image to get an idea.

https://www.dropbox.com/s/4b1qjifdtf981xt/Theme%20Screen-01-small.png?dl=0

In this image, I would like to make the planets slide to the 1st planet's position when swiped to right and slide back to their respective positions when swiped left. Planets are not in straight path, they are in an angular way. Does anyone have an idea on this?

Please help.

Thanks.
B
24
S
7
Posts: 335
Reputation: 2,220

Post » Sun May 08, 2016 6:09 am

From the image, I am assuming you wanna the planets to be rotate around in circular like Rotary Dial telephone.

One possibility is to use this math formula:

x = centerx + radiusx*cos(angle)
y = centery + radiusy*sin(angle)

Read more: http://www.themathpage.com/atrig/unit-circle.htm

Once you understand what these formulae do, you could extend it with for loop to loop through your planet and move these planets in circular motion.

Do you follow?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Sun May 08, 2016 9:49 am

@TwinBlazar OMG, I never though I could use geometry for my games :D. Could please tell me more elaborately on making it happen. Thanks.
B
24
S
7
Posts: 335
Reputation: 2,220

Post » Sun May 08, 2016 3:59 pm

I'll give you a little hint: First, just create one object, give it variable centerx = 300, centery = 300, radiusx = 100, radiusy = 30, angle = 0

every tick for the object, do this:

set angle = object.angle + 360*dt
set x = object.centerx + object.radiusx*cos(object.angle)
set y = object.centery + object.radiusy*sin(object.angle)

Now, run it and you should see the object spinning around in oval manner centered at 300,300. Now, imagine for loop for many objects... does that ring any bell?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Mon May 09, 2016 6:28 am

@TwinBlazar I tired your suggestion it is working great, thanks but this is not what I require. I wanna make the planets slide to another planet's position when swiped left or right. May be I didn't make it clear on the first place. If you see the image, those planets consists of 40 levels each. When the user clicked on of them, the user will be lead to level selection screen for a particular planet. Now, while selecting planets, I wanna make slide effect. For example, if I wanna select the second planet I will have to swipe to right, so when I swipe on the screen to right, the second planet has to slide over to the first planet's place and the first planet should go out of the screen. Likewise, when the second planet takes the first planet's place, all the other planets to should come forward to other planet's place.

Similarly, the exact opposite should happen when swiped to left. Did I make it clear? If not please let me know, I tell you more detailed.

Thanks.
B
24
S
7
Posts: 335
Reputation: 2,220

Post » Mon May 09, 2016 6:37 am

In that case, maybe you wanna try this? https://www.scirra.com/tutorials/756/se ... -waypoints

And then manipulate these planets' positions based on the waypoints.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Sat May 14, 2016 2:12 pm

@TwinBlazar I used lerp expression instead. It is working great. You can check it in the below link. Thank you so much for your time.

https://dl.dropboxusercontent.com/u/87665007/The%20Space%20Traveller/index.html
B
24
S
7
Posts: 335
Reputation: 2,220

Post » Sat May 14, 2016 11:33 pm

Congrats! That looks cool!
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Sun May 15, 2016 7:24 am

@TwinBlazar Thanks. :D
B
24
S
7
Posts: 335
Reputation: 2,220


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 5 guests