two game control, how?

RUPASRUPAS Member Posts: 823
edited November -1 in Working with GS (Mac)
hello friends, I am making a game and I would like that option to choose to play accelerometer or finger, as I can do this?

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Just use a global variable called 'control'.

    Have an option where you choose which control you use.

    If they choose finger, make 'control=1'
    If Accelerometer, make 'control=2'

    Then on your player character, have two sets of rules:

    If control = 1
    Put finger code here

    if control = 2
    Put accelerometer code here

    Hope that helps,

    QS :D
  • RUPASRUPAS Member Posts: 823
    I will test seems easy thanks friend
  • RUPASRUPAS Member Posts: 823
    do not get it to work the accelerometer, this is the rule I have;

    attribute game control = 2

    rule- right;
    attribute game acelerometery < -0,05

    move relative to actor additive

    rule - left
    attribute game acelerometery > 0,05

    direction 180 etc etc

    something wrong?
  • RUPASRUPAS Member Posts: 823
    help please....
  • RSCdevRSCdev Member Posts: 50
    Hey RUPAS,

    Sorry to be posting in your post without being a Master at GS BUT just trying to help you I would say 2 things for you check out into your project:

    1) Instead of the move relative to the "actor" try putting it relative to the scene;
    2) I do not know about that 0,05 you have put as value for the accelerometer but would try a smallest number there as 0,01 maybe...

    Hope you solve your problem.

    See yah,
  • RUPASRUPAS Member Posts: 823
    thank you all, the problem is with that nose if I have to create attribute is integrated or text? QS says global variable??
  • RSCdevRSCdev Member Posts: 50
    The attribute can be Integer and about the Global variable that QS said, if I understood well him wanted to mean as Global Attribute an Attribute in the GAME and not the Actors or Scenes as being a Game Attribute it can be "read" by any part of the game.

    PS: Sorry if I misunderstood something.
  • RUPASRUPAS Member Posts: 823
    I can set the accelerometer well, but I do not understand that attribute I have to create, integrate, text, real ....
  • quantumsheepquantumsheep Member Posts: 8,188
    Ok- use an integer.

    You can add attributes by pressing the middle tab at the top where all your actors are shown (it's called 'attributes'.

    Then press the '+' symbol to add the integer - call it 'Controls' (or whatever you like)

    If you have an options scene, you can make two buttons (to make it simple)

    When you press button 1, make the integer = 1 (we called it 'control' earlier, but you can call it what you want)

    If you press button 2, make the integer = 2

    Then, in your actor, put the rule:

    If attribute controls = 1
    Put in your code for accelerometer

    If attribute controls = 2
    Put in code for other control system.

    The 'controls' attribute does not change unless you press the buttons mentioned.

    I hope that helps!

    QS :D
  • RUPASRUPAS Member Posts: 823
    ok I understand, but integrate the attribute value can be 1? if the player first touches start and is not in options, this finger playing with the default
  • quantumsheepquantumsheep Member Posts: 8,188
    Yes - you set the integer to the default number for the controls.

    QS
  • quantumsheepquantumsheep Member Posts: 8,188
    Almost - you have 'if game controls = 2'

    Then do everything.

    You want a rule like that that says:

    If game controls = 1
    Do accelerometer stuff

    And then another rule

    If game controls = 2
    Do keyboard move stuff

    I'm not sure how I can make it any clearer without repeating myself - sorry!

    QS :D
  • RUPASRUPAS Member Posts: 823
    http://img836.imageshack.us/img836/8318/bugjl.png

    Uploaded with [URL=http://imageshack.us]ImageShack.us[/URL]
    .... I DO NOT UNDERSTAND THIS, THE RULE IS WELL accelerometer?? ACTOR DOES NOT MOVE MY NEVER with the accelerometer BUT WHEN SELECTING THE TOUCH
  • RUPASRUPAS Member Posts: 823
    THE ACCELEROMETER IS OK?? NOT FOUND IN MY ACTOR
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    WHY ARE YOU WRITING IN CAPITAL LETTERS? (sorry had to ask :P)

    If you send it over I can give you hand: giacomopoppi@gmail.com
  • RUPASRUPAS Member Posts: 823
    sorry it's true, you should not write in all caps, but someone can help me??
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    Uhm, I spotted a problem in the image you posted above.

    http://img836.imageshack.us/img836/8318/bugjl.png

    rule left
    move is relative to ACTOR

    Whilst

    rule right
    move is relative to SCENE

    Change one of them based on your needs. Then it should work. ;)

    Giacomo
  • quantumsheepquantumsheep Member Posts: 8,188
    Here, I made this for you.

    https://files.me.com/qsheep/ntrqx6

    Good luck.

    QS
  • RUPASRUPAS Member Posts: 823
    giacomopoppi said:
    Uhm, I spotted a problem in the image you posted above.

    http://img836.imageshack.us/img836/8318/bugjl.png

    rule left
    move is relative to ACTOR

    Whilst

    rule right
    move is relative to SCENE

    Change one of them based on your needs. Then it should work. ;)

    Giacomo

    not true, that's not the error
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    oh, ok sorry. I must have missed the point then.
    I'm sure QSs demo will give you all the answers you need ;)

    Giacomo
  • RUPASRUPAS Member Posts: 823
    uff does not work, the rules and had well before the problem is that when I select the menu accelerometer, then the player does not work, the accelerometer reacts.
  • RUPASRUPAS Member Posts: 823
    is possible than not found because my actor is animate???
  • quantumsheepquantumsheep Member Posts: 8,188
    Rupas,

    Have you tried the project I posted?

    It shows you how to change the controls.

    If you play it in the preview, you will be able to move left and right with the keys.

    If you play it in the iphone viewer, you will be able to use the accelerometer.

    QS
  • RUPASRUPAS Member Posts: 823
    if of course that I have proved to be not .... and I copied the same rules in my project and continues to go well if
  • RUPASRUPAS Member Posts: 823
    One important thing I do not want an iphone two controls and one for web, I want two controls for iphone, touch control and accelerometer 1 control, only to iphone, iphone web and do not want
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    RUPAS said:
    if of course that I have proved to be not .... and I copied the same rules in my project and continues to go well if

    Are you using google translator? (it messes up the verbs continuously!)
  • RUPASRUPAS Member Posts: 823
    yes, google translator..... sorry i spanish
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    Yeah, don't worry, I'm not judging you! i'm judging the translator! :P

    There are some spanish users on the forum, try contacting them with a spanish thread (I'm not sure if that is allowed though ;) )

    Giacomo
Sign In or Register to comment.