Psynaptik's Recent Forum Activity

  • Bizarrely, it does.

    At first I thought, "maybe it's mapped to the right axis?". But then I've made an example program here to test inputs and it said it's the left stick.

    dropbox.com/s/96hn02r0haqyxjx/ControllerDetect.c3p

    Then I tested a new export of my game and...it works! Although fullscreen isn't working for some reason, but that's another thread!

    Thanks for your help anyway, and for pointing me towards that example. I've seen it before, but reminds me to not assume directions are mapped to the left stick (could be right as well).

  • But I don't know what to map them to.

    I have no idea how Construct3 is detecting the joystick. It's not defective, it shows up on html gamepad testers as axis 0. But how do I map this within Construct3?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have a generic USB controller I'm using on an arcade cabinet.

    Made a game using dpad buttons, was all good on computer. But then tested on arcade cab and found the joystick mapped to X and Y axis, not POV. NOTE: There is no left/right stick, just X/Y.

    So I rewrote the controls code to detect the X/Y of the Left analog stick.

    Tested the game on the arcade again and...it still doesn't work.

    How can I find out what input is being detected when I move the joystick (so that I can map it within the code)?

  • YOu're 100% correct in your assumptions. That's what I've got.

    I think your solution works well for trigger events (e.g. jump, shoot), where it would be an action for the first frame only. I think it may not be the way for 'continuous' actions (e.g. moving left/whilst (x) key is down..).

    It's those continuous actions which are the problem! I need a 'if I push the left axis up then simulate pressing the up key!'.

    Might just have to be a less elegant but more expedient code addition operation...

    However, I wonder how people modularise or design this type of thing for multiple control schemes where continuous button presses need to be accounted for. 'Whilst (x) is held down...then...', etc. Would functions be okay for that?

    LATER EDIT: Went away and did what you said - does work, included for 'continuous' direction events.

    I've made an example for anyone else that has this problem in the future:

    dropbox.com/s/bpcgh07khcgycem/controlWithFunctions.c3p

    (explanation: Made a game on my desktop, but was to go on an arcade machine. Turns out that the joystick in arcade machine was mapped to gamepad axis and not POV/hat cardinals - hence the question. Since I've got state machines for movement in there and all sorts didn't fancy rewriting all the code that had taken me AGES to re-write, so I've kind of 'hacked' in the axis controls on top. But next time - winners use functions people!)

    Thanks to dop2000! Never thought about using functions for movement.

  • I want to have the axis of the left gamepad joystick mapped to another button on the controller (unique scenario for a game that will only be played in one place).

    i.e. when I press left on the analogue left thumbstick, this would be the same as a digital press of left POV or another button on the gamepad.

    I can't do 'if left axis is more than' OR 'button X pressed' because I have a redefine keys system that only takes numbers that relate to the button number pressed (i.e.it's a digital system).

    So I want 'if left thumbstick axis > 30, then simulate pressing button LB', for example.

    Not immediately apparent. Is there a workaround that I've missed? Or do I need to use an external program (AutoHotKey, vJoy, Joystick Gremlin etc.) to do this?

  • Brilliant, that's really clear and helpful. Thanks!

    So you just save the whole array/dictionary to one item in LocalStorage? That makes things much clearer.

    Cheers!

  • I have a game where I have redefine keys screen.

    When I redefine the keys (press key for left, key for right etc.) they're put into an array and then I loop through that array to set global variables.

    But this of course isn't persistent between sessions. What would I do to save and then load that array?

    I suppose the answer is localStorage? But I can't work out how it works. Do I need a dictionary? JSON? Something else?

  • Perhaps I didn't make myself clear.

    If I have a sprites called 'floor', 'wall', 'ceiling' etc., how would I choose one of them using their name?

  • Ah yes! Thanks LogicArts, I think you're right. I could search by Key and then get the value.

    I'll see what I can do with that.

  • If I want to loop through an array, using a field from it to provide the variable name, and another field to provide the value, how would I do it?

    More to the point (and this is the conclusion I'm coming to...), can I even do it in C3?

  • But what is the variable? There's no variable for the name of an object.

    In Unity this might be GameObject.name, but what's the equivalent in C3?

  • What's the variable I use to access an objects name within a function?

    I want to do this:

    * Pick an object by its name (which is supplied by a field in an array)

    * Make it visible.

    It seems weird that I would copy the object name into an instance variable and then use that, but I can see how to do that. Surely that's not the best way?!

Psynaptik's avatar

Psynaptik

Early Adopter

Member since 7 Nov, 2013

Twitter
Psynaptik has 1 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies