character respond to touch/animations

Get help using Construct 2

Post » Thu Apr 04, 2013 8:59 pm

Ok so I am new at this. I am familiar with the way to make a character respond to touch indirectly through objects. Like "clicked on left arrow. simulate 8 direction to left" As well as how to make touch control work for a single animation.
But I was wondering if there's a way to make a character go a certain direction by using touch controls {b}corresponding to the animations{/b}, walkup, walkdown,walkright, walkleft. The game I am working on is a RPG so side scroll controls wont work in this game. I was wondering you guys could help me out at all possibly. Thanks
-Seth
B
4
Posts: 10
Reputation: 320

Post » Thu Apr 04, 2013 9:13 pm

I am currently working on an RPG and I am using a joystick object and directional panel. When the player drags the joystick and overlaps one of the panels it triggers the movement event. When the player lets go of the Joystick it Activates a group of events the move the joystick back to its source and then Deactivates the group. I am using a dictionary object to retain location and direction data for webstorage later.

I can screen shot my events if you like but this flow chart might help:

B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Thu Apr 04, 2013 9:16 pm

That would be great if you could give me some screenshots. Thanks appreciate it. How do you use a dictionary? Thanks
B
4
Posts: 10
Reputation: 320

Post » Thu Apr 04, 2013 9:24 pm

I really wont it to respond to touch with the corresponding animations. :)
B
4
Posts: 10
Reputation: 320

Post » Fri Apr 05, 2013 12:15 am

Basically a dictionary is a place to store information as global variables. It makes it easy to pre-program lots of content into your game in notepad form without having create an event for each entry. Here is how to set one up:

Capx Example
Dictionary Setup
1. Create a dictionary object (this is a global object)
2. Create what I call a "validate button"
-Create text box called validate
-Create event "On left click of object 'textbox validate' download DictionaryasJSON AND set textbox value to DictionaryasJSON
3. Launch your game and click on the 'validate' object and download the JSON file. This will provide you with a template for adding values by hand instead of having to push them all initially.
4. Find the JSON file and put in all your keys and values (you will need to set it to open with notepad)
5. Save the JSON notepad text file and in construct2 right click on the "Files" folder on the project list typically on the right hand side and select "Import files" then select the JSON file you just modified. (from now on you can doubleclick the JSON file in the project to modify it and blow the other one away.
6. Set your "on layout load" to set the dictionary to the contents of the JSON file (this is to initially populate it, these values will remain as long as the game is running as it is stored in RAM)
7. Now you can use the Dictionary Set key and Dictionary.Get to call upon values like to set and start the name of an animation stored in it.

Json Validator

Here is my event view for the virtual joystick and keyboard controls
Alexixiv2013-04-05 00:28:31
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Fri Apr 05, 2013 5:36 pm

K so I finally figured out how to make touch respond to animations it was so simple I couldn't believe it took me so long.

So what I did make a first sprite the animated one select behavior "pin to". Then make a second blank sprite and select "8 direction". Then make a 3rd blank sprite. Pin it to sprite 2. Then create 4-8 blank sprites corresponding to the directions. Pin them to the 3rd sprite. Then in event sheet select "is in touch." It's pretty straight forward cannot believe I didnt think about that.
B
4
Posts: 10
Reputation: 320

Post » Fri Apr 05, 2013 5:39 pm

It just basic eight behavior movement with a little bit of a twist
B
4
Posts: 10
Reputation: 320

Post » Fri Apr 05, 2013 7:15 pm

[QUOTE=snewman8771] It just basic eight behavior movement with a little bit of a twist
[/QUOTE]

Really!? do share a screen shot of your event sheet. Glad you found a way that works for you!
B
6
S
3
G
1
Posts: 102
Reputation: 1,379

Post » Fri Apr 05, 2013 11:32 pm



B
4
Posts: 10
Reputation: 320

Post » Fri Apr 05, 2013 11:37 pm



K so basically I used the regular method to get 8-direction. By creating a animated sprite. Then creating a blank sprite and pinning it the the animated one.
Then I created a 2nd blank sprite about 3 times the size of the second sprite. Then pined it the the first blank sprite. Then I created 4 blank sprites that correspond to directions. and pinned all then to the third one. It follows player around wherever he goes.
B
4
Posts: 10
Reputation: 320

Next

Return to How do I....?

Who is online

Users browsing this forum: blackhornet, jeffige and 1 guest