edited April 2015 in General Discussion
Hi. ^^
I have a script that use screen touch to move the player, but i would like a more elegant solution... With great surprise, i could make a script that move the player in four direction (it is a 2D top down game) while pressing one of four GUI Texture. The problem is that these textures are in the scene, and they are used by the script. Activate and deactivate the script through ORK is not a problem (in custom controls/blocks) but i would like to know if there is a way to have 4 GUI elements made in ORK and link those to my script.
Or if there is another way with just ORK system. :)
Thanks in advance. :)
  • Why would you want to recreate something that's already working?

    If your player control uses ORK input keys, you can use a Control HUD to do this. Otherwise it'd probably be more complicated, e.g. using global events (called by input keys that are set via the control HUD) to call your movement script.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • First sentence is so true.. But actually movement is a bit odd with screen touching, so i tought that having gui elements touched/ clicked would perform better. :-)

    However, may i link HUD to my script function? Could it work if the HUD activate the ORK input and the input activate script funcion, like it would be a mouse or touch? My GUI texture can activate the script quite well, but using external textures is quite annoying as i cannot control them with ORK.

    Tips? ^^
  • Control HUD sets the input key > the input key calls the global event > the global event (game event) calls your function.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited April 2015
    Oh that could work, but i could get some problems with 2D Toolkit and animations... ^^

    Is there a way by script, a code line, in which i could check if a specific HUD is checked?
    something like:
    if (ORKHUDUpButton.pressed) do various stuffs...

    Or another way i was thinking about, is it possible to hide some GUI textures like HUD, if you are in battle, pausing, menu screen etc...?

    EDIT: Does limit time in Rigidbody - Add Force works properly? My player seems to keep moving even after the 1 second of limit time i set, even if i use wait and i set the next step to Stop Rigidbody.

    Thanks for the help. :)
    Post edited by Kaemalux on
  • Not on the HUD, but on the input key it controls:

    if(ORK.InputKeys.Get(int index).GetButton())

    index is the ID/index of the input key.

    HUDs have display conditions, e.g. game states like in battle, in control, etc.

    Should be working, but keep in mind that add force adds a force to a rigidbody that'll continue to be there until stopped.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • So if i link my HUD to a control, and it simulate a shortcut with ORK Keys, i can use that line of code (replacing only index with the number corresponding to key?) to call the input inside my custom script?

    Never scripted anything using ORK code so i am totally unexperienced. :D

    I use Stop rigidbody after 1 second but it doesn't seem to stop... ANy tip?^^
  • Send me your event and the rigidbody settings (or a small test project) :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Still you got my last project i sent?

    Player, rigidbody, colliders are still the same, i just made a global event in which with a key pressed add a force on x direction for 0.5 sec and then i use the Stop Rigidbody event. ^^

    If you still have my project you can test in in 5 minutes, if not i will resend you a project as soon as i can. :)
  • Nope, don't have the project - they usually go into the bin once the problem is solved :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yeah, right. ^^ I ll try to sent you a copy ASAP. :)

    About custom textures, could be hidden somehow like HUD in battle/event/etc... or it can be related only to ORK object and not general GUI elements?
  • When you're dispalying custom textures outside of ORK, that's up to your scripts :)
    You can check ORK's states there if needed, e.g. to see if the player can be controlled:

    if(!ORK.Control.Blocked)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.