Wayward souls controls

darrigaz

  • Posts: 124
I've got a sort of top down action game and  I want to emulate the controls from Wayward Souls.

Basically:
If you swipe on the left side of the screen the player moves in that direction.
If you swipe up on the right side of the screen you do a special move.
If you tap on the right side of the screen you attack.

I've run across a tonne of issues trying to do this.

1)There are no diagonal swipe so you can't detect them and move in diagonals
2)Stencyl doesn't return any information about swipes so you can't detect what side of the screen they're on
3)The multi touch code is split up into three different events and there's no documentation about how to pass information inbetween them so I'm having a hard time constructing my own swipe detection code

Can anyone help with those or the behavior in general?

sdieters

  • Posts: 2068
Challenge accepted =)
I will let you know when a video tutorial is being created!
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p


sdieters

  • Posts: 2068
Can you point me out a bit if you have specific actors you have to swipe over, or just somewhere in the left or right side of the screen?
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

darrigaz

  • Posts: 124
I was working with a blank left side of the screen and a big on screen button on the right.  Guess it doesn't really matter how it works, if it works.

I was hoping to handle all the input code from within the player actor just because the game's getting pretty big and having it split into scene or other actor behaviours is becoming increasingly hard to track.

sdieters

  • Posts: 2068
it really does make a difference actually. atm I am working on a behavior which doesn't use any buttons, but if you decide to with a button it will change everything since i have to check if the touch was on that button yes or no.

Currently everything works from one actor behavior.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

darrigaz

  • Posts: 124
Behaviour that uses no buttons is totally fine for my purposes.

I'm really interested in seeing how you construct code to interpret input as a swipe! :)

sdieters

  • Posts: 2068
HAH. Just for the fun of it, this is what I had to do only to recognize a multi-directional movement with a minimum movement threshold for each individual touch on a part on either the left or right side of the screen. There is no use with this state of the behavior just yet, but it is an important foundation for adding the control that you would like to have. Tomorrow I will continue by adding the diagonal recognition part.

The second screenshot is made in-game. The lines of code you see is build up like this:
touchID, touch X origin position, touch Y origin position, touch X current position*, touch Y current position*

* = on the right side of the screen these positions will be compared with the origin positions to determine which way we swiped, while on the left side these numbers will be compared to see what way we have to move the player.

EDIT: When posting this I realized I only have to allow one touch on each part of the screen, so even this needs a good overhauling. But on the sunny side, with this behavior you can do a local multiplayer with swipe controllers hahaha.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

sdieters

  • Posts: 2068
Here is an update video. Let me know what you think =)
Don't mind the low quality. My actual tutorials are in full 1080p HD quality!
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

darrigaz

  • Posts: 124
That's a cool start. You've essentially made a custom virtual thumbstick but using clever dynamic lists rather than actors!

I previously had a similar thing that was making an actor when you touched with a mouse and then another one on top that followed your finger, then I calculated the distance between the two. If it was beyond a certain threshold you moved and if it was beyond another threshold the front of the joystick snapped to a point along the line between origin and your finger (using some trig it took me about a month to understand).

The trick with wayward souls is that if you're moving you don't have to go back past the origin to move in the opposite direction. It essential works out that you're moving in a specific direction and updates your player movement accordingly. Still looking forward to that coming soon!

sdieters

  • Posts: 2068
Can you explain that last part a bit more? The way i understood it was that you dont work a thumbstick idea, but the player moves towards the direction you swiped without you needing to hold that position with your finger. Is this right?
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

darrigaz

  • Posts: 124
It's tricky to explain without actually playing it.

Essentially if you touch the screen and move your finger down a little from the origin your character starts to move down. Then you can hold your finger in the same place on screen and your character will continue to move down the screen. So far so thumbstick.

If while you're moving down you suddenly change the position of your finger, say by sliding it right,  the thumbstick will totally re-orient and you'll start moving right (not down and right). You can slide your finger in any of the 8 standard compass directions and it'll instantly move you in that direction. You stop moving when you take your finger off the screen.

It means that you can change direction instantly rather than by moving your finger large distances across the screen to get back to wherever you first touched, as an added bonus it also means that you don't need a joystick image on screen obscuring the game (because you never need to know the relationship between your finger and the joystick's origin).

sdieters

  • Posts: 2068
Ah i get it. Would you like to have that control setup rather then the one i have now?
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

darrigaz

  • Posts: 124
Yeh that's what I was asking about. Your current code is still interesting though. Hadn't occured to me to build a list of touch inputs and handle them by checking the list, that'll still work for left or right, which is great for left=move right=attacks.

sdieters

  • Posts: 2068
Download the attachment and install in on your device and tell me if this is what you are looking for. if you have any things that I should improve, let me know =)

P.s. this is just the movement. so there are no attack controls in this APK. just use the left side of your screen to move around.

HINT: Use dropbox on your pc to store the APK. Instal dropbox on your device and install it from there. Scaling was disabled, so the screen can be a bit off.
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p