Is there a possibility to draw a path?

Get help using Construct 2

Post » Tue Dec 31, 2013 8:31 am

Hello,

just wondering if there is any possibility, to draw a path on which the object is moving instead of let it search for the shortest way.

Thanks:)
Image
Check out our start-up and configure your own helmet in true 3D.
B
44
S
11
G
11
Posts: 1,154
Reputation: 9,988

Post » Tue Dec 31, 2013 9:06 am

yep

interchange mouse and touch, but I like touch.

If is in Touch
Get Closest Node Sprite.
Is node Sprite > 50px
YES Then Create Node Sprite at Touch.xy. node.pathnum = node.count

On Release
Start PC Move

PC Move
Move PC towards nearest node

upon overlap of Node.
destroy node
Start PC Move


continuing on
If Touch start
node destroy all

and that's the gist of it. size your node and distance however you want.

I would say 99% of the time the question isn't "Can C2 do feature X", but instead "Am I clever enough to figure it out."... the answer is yes given time.jayderyu2013-12-31 09:08:02
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Tue Dec 31, 2013 9:30 am

@jayderyu

Hey, thanks for your answer :-)

This sounds really interesting, but is not what im looking for :-D

I want to create something like this. Moving platforms, that follow a route, icreate.



Have you got any tips for me? :) Pathfinding behavior isnt really optimal I guess ( at least in the way I use it :-D )
Image
Check out our start-up and configure your own helmet in true 3D.
B
44
S
11
G
11
Posts: 1,154
Reputation: 9,988

Post » Tue Dec 31, 2013 11:10 am

how about something as simple as:

find path, follow it ... every tick have the object moving spawn a dot ?
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Tue Dec 31, 2013 11:25 am

It shouldt draw a line. :)

Maybe im explaining too bad haha :-D

I want an object to follow a shape. Maybe a vector line or something like that line in the mario game. I want the platform to move exactly where I want it to, so that it looks like it is sticked to the line :-P
Image
Check out our start-up and configure your own helmet in true 3D.
B
44
S
11
G
11
Posts: 1,154
Reputation: 9,988

Post » Tue Dec 31, 2013 11:40 am

ah I see :)

Something like an object which is able to move between two spots, and you can determine with player controls if the moving platform is going left or right along the given pathway ?


I would place a simple line on the screen (floor), add a box/plate(wheree you stand on) with platform behaviour on top of that, controls intially disabled.

And as soon as your character lands on the platform, transfer default controls from your character to the platform and pin your char to the platform, and limit movement to left and right. (steers platform)

When you press something like jump, you could unpin and swap the controls again finishing by a jump command.

Something like that ?
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Tue Dec 31, 2013 12:15 pm

@lennaert
Gosh, what great ideas, but not what I was exactly looking for :)

My game will be top down, the Mario plattforms were just examples.

I made up something to make it clearer:



What I want now, is to let an object follow these laserlines in endless circles. I tried pathfinding behaviour and filled the whole screen with invisible solid sprites, but it acts somehow weird.

Really hope that you can help me now, it's essential for my whole project:-)

Thx a 1000 times friends :)
Image
Check out our start-up and configure your own helmet in true 3D.
B
44
S
11
G
11
Posts: 1,154
Reputation: 9,988

Post » Tue Dec 31, 2013 12:37 pm

Give your main object custom movement and put an invisible target object at each corner of the path. Give each target a variable that allows you to number them in sequence in the layout editor. Using events, pick the correct target by filtering for the correct variable value and then set your sprite to track towards it. Then, on collision with the target just as 1 to the target variable value, unless you're at the end when you reset to the start.
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,255
Reputation: 46,484

Post » Tue Dec 31, 2013 2:09 pm

Take a look at This topic and specifically rojohounds example, which has been edited for later construct versions on the second page by Ramones.LittleStain2013-12-31 14:11:37
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 31, 2013 7:16 pm

Actually. My example still follows the same principles.

Create a set of nodes. ID them for a follower. Then move the platform node to node. Even if your not drawing them, but instead creating them during edit time.

I would however add a criteria of naming the platform and path so that platforms stick to there path nodes.

You could use the idea of following a vector line, but it's over kill for a Mario like platform game.

You can also give the nodes instructions.
Forward. move the platform in a count up ward path.
Back. Send the platform on a backward count down path.
drop. have the platform fall off the screen.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Next

Return to How do I....?

Who is online

Users browsing this forum: OddConfection and 12 guests