"Aquaria-Like" Mouse Leading Possible?

New releases and general discussions.

Post » Sat Dec 19, 2009 4:26 pm

I'm generally not that fond of 2D games, but when I saw all of the effects that can exist in a 2D game as demonstrated in "Aquaria", I sort of changed my mind.

There are a lot of advanced behaviours going on in this game, but the navigation, alone, is quite compelling. Rather than verbally describe it, take a look-see at the demos:

[url:yvpiy4pm]http://www.bit-blot.com/aquaria/[/url:yvpiy4pm]

Is this kind of "mouse leading" navigation a difficult thing to accomplish, for a beginner, using Construct?

Since the game takes place in a weightless, "aquatic" environment, gravity is not much of an issue. But, watching the demos of Aquaria got me thinking about how difficult it would be to make a similar game, where gravity takes the form of whichever "walking" surface you are closest to - (floors, walls, ceilings or slopes) - a kind of "magnetic" gravity involving special collision detection, I would imagine.

Anyone care to comment?

Psmith
B
2
G
3
Posts: 25
Reputation: 900

Post » Sat Dec 19, 2009 6:59 pm

No, leading the player with the mouse is not hard. You can do it in one event:

http://dl.dropbox.com/u/529356/mouselead.cap
Made in v0.99.62. Hold left mouse to move the circle.

If you wanted something like acceleration and deceleration it would simply be a matter of adding another event or two.

Also, this isn't the only way you could can do this. You could use a behavior like Bullet, 8Direction, Custom Movement, or even Physics, instead of coding your own. But it's such an easy movement to make I don't see why you'd need to.

As for the different gravity directions... yeah, that would be harder to do for a beginner.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 19, 2009 8:29 pm

DeadEye:

Thanks for putting that together for me. Only 2 events - that is economical.

But, I would have never been able to put that together for myself - not with my Zero knowledge of that kind of programming. (Lerp and all that). What or Who is Lerp? (Don't feel compelled to try and explain). I imagine that has something to do with how the ball accelerates and decelerates - or seems to, anyway.

And, thinking about the problem, again, I would probably approach that kind of simulation "physically", using a "spring" attachment of the player to the mouse cursor.

Really, thank you,

Psmith
B
2
G
3
Posts: 25
Reputation: 900

Post » Sat Dec 19, 2009 8:54 pm

Heres a slightly easier example:

http://dl.dropbox.com/u/939828/dolphin.cap

Basically I attached 'custom movement' which allows me to move the dolphin with more realistic physics.

Lerp lets you take a number, and another number, and find an inbetween number.

eg

lerp(0, 10, 0.5) is 5

lerp(10,20, 0.5) is 15

2 * timedelta is about 0.03 so basically in deadeyes code it means that you take a lot of the current position, and a little bit of the mouse position...and place it between.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Sat Dec 19, 2009 9:37 pm

[quote="Psmith":2echtzze]What or Who is Lerp?[/quote:2echtzze]

It stands for "linear interpolation," and it's a very useful and powerful math function. I had no clue what the hell it was when I first started to use Construct, but once it was explained to me (see David's post above) it made complicated stuff a lot easier. I know you're adverse to the whole coding side of things, but lerp() is a really good one to know.

In my opinion, everyone should make friends with lerp() and clamp(), which is also so useful it's sickening. There's a list of system math expressions here on the wiki:

http://sourceforge.net/apps/mediawiki/c ... xpressions

Lerp() and clamp() are under the math section.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 19, 2009 10:10 pm

[quote="deadeye":1366myzv][quote="Psmith":1366myzv]What or Who is Lerp?[/quote:1366myzv]

It stands for "linear interpolation," and it's a very useful and powerful math function. I had no clue what the hell it was when I first started to use Construct, but once it was explained to me (see David's post above) it made complicated stuff a lot easier. I know you're adverse to the whole coding side of things, but lerp() is a really good one to know.

In my opinion, everyone should make friends with lerp() and clamp(), which is also so useful it's sickening. There's a list of system math expressions here on the wiki:

http://sourceforge.net/apps/mediawiki/c ... xpressions

Lerp() and clamp() are under the math section.[/quote:1366myzv]

Is there a thread or post anywhere that gives practical examples of what expressions like that can be used for? For the mathematically challenged or those who suffer from Dyscalculia (such as myself) Lerp gives an inbetween number and that's it. Would be nice to see examples of possible real world uses for that and other expressions, such as "Lerp could be used for X, Y, Z among other things", just to get the old brain working. Be a handy thing to reference for new users too.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Sun Dec 20, 2009 12:36 am

Hey, I didn't know about the Clamp() one! Awesome stuff, will save me a lot of sub-events!
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Sun Dec 20, 2009 6:00 am

[quote="Lost my Keys":2phh7jpp]Is there a thread or post anywhere that gives practical examples of what expressions like that can be used for? For the mathematically challenged or those who suffer from Dyscalculia (such as myself) Lerp gives an inbetween number and that's it. Would be nice to see examples of possible real world uses for that and other expressions, such as "Lerp could be used for X, Y, Z among other things", just to get the old brain working. Be a handy thing to reference for new users too.[/quote:2phh7jpp]

Check the wiki.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sun Dec 20, 2009 6:35 am

just go look in older pages of the YC and uploads forums. there are litterally tons of awesome caps and exes demonstrating things that have been lost to new stuff over time, and new users are really missing out.

uses of lerp? there are way too many. even more impressive are qarp() and cubic() , theyre like lerps big brother, for interpolating beziers of 3 and 4 points respectively. cosp(), a special "lerp" which does basically the same thing, except the interpolation is denser near the ends in a sort of curved fashion, using sampling from a cosine wave. can be used with lerp or all by itself for different effects. all of them take a parameter "t" which is a value from 0-1. that value is the percentage of the way through the interpolation. .5 being 50% 1 being 100% .25 being 25% ect
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun Dec 20, 2009 7:54 am

lerp(a,b,t)
- where a is the starting point and b the ending point, like this:
a = bottom-most stair step
b = top-most stair step
- t is basically transition or time, a real number between 0 and 1, where 0 is the beginning and 1 is the end.

When you stand on the bottom-most stair step, you begin clocking at 0. Add a second to the time (normalized to scale of 1) and find yourself on the second step. Add another second and you are on the third step, et cetera until at time = 1.0 you are finally standing on top of the stairs.

But wait! You can rewind in time! Pick the time - where were you at half the time? Set t= 0.5 (50%) and amazingly enough you find yourself half way on the staircase! Woo, time manipulation!
[code:34gg056l]
|o------------| |-----------o| |-----o-----|
a b a b a b
t=0 (0%) t=1 (100%) t=0.5(50%)
[/code:34gg056l]
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests