Arrow Key / Controller Movement + Spine Animations

  • #1, by AvenThursday, 23. June 2016, 11:26 8 years ago
    Hello Community,

    1. I am working on a sidescrolling adventure and would like to that the player can move the hero by pressing arrow keys / controller instead of pathfinding via mouseclick. Is this possible and if yes how? I am not good in programming languages so it would be nice if it's understandable smile


    2. Second question is: If there a spine support or something else? I have really big images with animations which should be really smooth so the standard sprite solution isn't workable for me. Can you tell me how I get spine animations ready or which alternatives there are?

    Thank you!
    Alex

    Newbie

    23 Posts


  • #2, by afrlmeThursday, 23. June 2016, 13:55 8 years ago
    Yes there is Spine support or is it Spriter? I'm pretty sure we have Spine support since Visionaire Studio 4.2.5, but I've not gotten round to testing it out yet & we currently have no documentation on how to use Spine animations / runtime library with Visionaire Studio. Maybe SimonS (one of the engine devs) will be able to provide a bit of help on that.

    Yes it's possible to use either or both Key input &/or game pad to control your characters. Lua is recommended for setting up both, but you can use the "key actions" under the Game (cog icon) tab for creating certain actions / events based on which button / key is being pressed or has just been released. By default the left stick is automatically mapped to character walk, so it's plug & play. I don't remember if the right stick is mapped to the cursor or not by default. Again SimonS would be your best bet on information regarding this as I've not had reason to really test it out myself yet.

    In regards to Side-scrollers, they are possible as a couple of members on here create them, though they are more point & click based than actual action platformers. VS isn't really geared towards other genres of games besides third & first person point & click games, but that's not to say that other genres can't be made with it, just some of them require various workarounds to make them work as you want them to work.

    Imperator

    7278 Posts

  • #3, by AvenThursday, 23. June 2016, 15:03 8 years ago
    Hello AFRLme,

    thanks for your help. I hope SimonS can go deeper into it later. And yes I know, I don't want to make a platformer. But than you could make something like "badass inc" (based on collision if character is near to someone or something for interact). So you need no mouse and don't have to wait if the hero will run along this path to get to the clicked object. For lots of games it has a better feeling if the player can directly move and interact with his hero. That's why I am asking. And for 2D games like "badass inc" or "Superbrothers: Sword & Sorcery" (without fighting possibilities) this would be really awesome if it would easy possible to implement while using Visionaire.

    And by the way: I wish there would be official tutorial or manual grin

    Newbie

    23 Posts

  • #4, by CrossThursday, 23. June 2016, 15:14 8 years ago
    For Keyboard/Gamepad-controls i...

    1. created a key-action (pressed) to start another action called "Rechtsgehen" (Picture 1).
    2. created the action "Rechtsgehen", which loops a lua-script for movement to the right (Picture 2).
    3. created a key-action (released) to stop the looped action and added "stop character".
    For movement to the left, just change the lua-script to "x = pos.x - 20".

    Works great for any keys or the d-pad of a controller. It's also possible to create turning-animations or stop-walking-animations that way.

    Newbie

    92 Posts

  • #5, by AvenThursday, 23. June 2016, 15:38 8 years ago
    Hey Cross,

    that's awesome! Thank you for the great explanation and screenshots. I still tried it out and it worked! smile

    Thanks
    Alex

    Newbie

    23 Posts

  • #6, by CrossThursday, 23. June 2016, 16:14 8 years ago
    Your welcome!

    One problem here with keyboard-input is still that you can press both keys at once (which is not possible with the d-pad). Right now the actions are designed for: press left - release left - press right, not press left - press right - release left. You can fix this, if you ad a condition to the keyaction and an if-structure to the loopaction. It's more complicated, but let me know if you would want any help on that also.

    Cheers, Cross.

    Newbie

    92 Posts

  • #7, by AvenThursday, 23. June 2016, 16:52 8 years ago
    Yea, you are right smile I will ask if I need help.
    One another question: Is it possible to use the way points to tell the character how he has to go (if it's not a straight line). So if I press right the game knows he has to go the right way but along the waypoints?

    Newbie

    23 Posts

  • #8, by afrlmeThursday, 23. June 2016, 17:45 8 years ago
    The only way to get it to automatically follow nearest way point path is to specify a destination outside of the way borders, but it's a bit hit & miss. You can do left & top with a x,y coordinate value of 0 or -1 no problem. The issue is bottom & right because you need to know the scene width & height if you want to use a global function as opposed to writing a custom script for each scene.

    Using the method Cross has provided is basically adding + 20 pixels to whatever the current x position of the character is, which means the character will more likely than not walk 20 pixels to the right rather than letting the engine calculate the closest destination path. Typically when you control a character with a keyboard or game pad, you let the player walk wherever they want to walk within the invisible boundaries of each scene / room.

    Imperator

    7278 Posts

  • #9, by CrossThursday, 23. June 2016, 17:48 8 years ago
    The lua-script i used (which by the way AFRLme wrote years ago - thanks again) tells the character to walk in a straight line on the x-axis. If a wayboarder apears, the character will stop. Waypoints are not needed or possible to use with the script. (I don't quite understand what you would need them for? In a sidescroller game you always walk on a straight line, no?)

    But there is a command "send character to destination", that you could use to send the character to a waypoint at the end of the Scene. The Problem is, that you have to define the destination for each Scene, it dosen't automatically pick up the waypoints you set in the Editor.

    Newbie

    92 Posts

  • #10, by AvenThursday, 23. June 2016, 17:58 8 years ago
    Hi, I mean something like this. Do you see the stairs on that image? I want by pressing right he goes right (but on the way). So I thought the easiest way could be to use the paths so he won't suck. It's no straight line.

    https://cdn2.recombu.com/media/mobile/news/legacy/M14179/1303377189_w670.jpg

    or easier explanation:

    https://answers.unrealengine.com/storage/temp/35879-linearstair.jpg

    Newbie

    23 Posts

  • #11, by afrlmeThursday, 23. June 2016, 18:04 8 years ago
    Use an event instead. Inside of the way systems tab is an action area tab in which you can trigger events when characters or a specific characters enters or exists a particular action area you define. So, you could when the player enters the stairs location create a cut-scene in which you automatically control the players movements.

    Imperator

    7278 Posts