How do I create a "walk-to-run" key toggle?

Get help using Construct 2

Post » Fri Nov 14, 2014 5:45 pm

Hi Everyone!

I have stumbled upon my first logic problem with Construct 2. I'm creating a game where I want the main character to shift between walking and running while holding down a key. (i.e the "shift"-key.)

The running mechanics works if I hold down shift before I press ASWD-keys, but I can't toggle between the modes while walking or running. is there any obvious mistake in Event Sheet? Can anyone give me some kind of clue on how to approach this problem?

(I case you're wondering what's up with all the groups in the picture: my initial thought was to reduce instructions per clock cycle by activating and inactivating groups in the event sheet, but actually don't know if it is doing any good?) :roll:

Image
Last edited by g3nki on Sat Nov 15, 2014 9:00 am, edited 1 time in total.
Currently working on "Unsung" - an open world platform adventure for PC and Consoles. follow me on Instagram :D
B
19
S
2
G
2
Posts: 52
Reputation: 1,276

Post » Fri Nov 14, 2014 5:53 pm

Because whenever A or D is down you set group running deactivated and walking activated. Personally, I would give the sprite a variable for whether the character was running or not. Then under the 'A is down' and 'D is down' events, include a sub event with a value comparison on the variable, and create an else to it then have the walking and running methods under there and just have shift toggle that variable.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Fri Nov 14, 2014 6:39 pm

walk-to-run..without Shift key..
You do not have the required permissions to view the files attached to this post.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sat Nov 15, 2014 12:30 am

korbaach wrote:walk-to-run..without Shift key..

Thank you, i didn't have any use for this now. But I will look into it, because I'm going to use timers for sprint mechanics, this seem to be of great help. :)

briggybros wrote:Because whenever A or D is down you set group running deactivated and walking activated. Personally, I would give the sprite a variable for whether the character was running or not. Then under the 'A is down' and 'D is down' events, include a sub event with a value comparison on the variable, and create an else to it then have the walking and running methods under there and just have shift toggle that variable.


Thank you! This helped me a lot getting on the right path. :) I had to skip the whole activate/deactivate group idea, which is pretty sad. My Event Sheet is starting to become pretty massive due to redundant operations. After working for three years as a C# and .NET developer I find these event sheets are extremly unflexible. Perhaps it is just me being a noob at Construct 2. :oops:

This is my Event Sheet today, There's so many things that are being declared over and over again. :|many things may look a bit necessary, but this was the only way I got everything to work. I use two kind of forward movement, "running" and "walking", I also have two kind of jumps: a "high jump" and a "long jump". It's a lot to take account for, especially since it's just standard jump- and run mechanics... Is there anyone out there that can explain how to make cleaner, less redundant event sheets?

Image
Currently working on "Unsung" - an open world platform adventure for PC and Consoles. follow me on Instagram :D
B
19
S
2
G
2
Posts: 52
Reputation: 1,276


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests