Using a squared score / Accelerometer changing actor location

FallacyStudiosFallacyStudios Member Posts: 970
edited November -1 in Working with GS (Mac)
I got 2 questions for this one.

1. I'm trying to square my score and I'm having a difficult time figuring out which one it should be. I tried: game.score + pow((game.Redactive*10), 2). Its an attempt to add whatever num redactive is times by 10 and squared to score. No matter what redactives was it was giving me an add of 10.

2. I'm trying to make it so that the score display always goes to the top of the screen just like rotating the phone from portrait to the upside down would rotate it except I don't want any other actors changing position in that way. I just want it to basically move to the top of the phone no matter which angle I turn it. Ive tried using accelerometer, but if lets say X acc was changed and it is set for Y it sometimes gets stuck on the bottom when it should be top and then it continues changing in opposites. (I also plan on rotating it as well, but just trying to get this part to work first). There an easier way to do this maybe so the phone rotation only works on that actor or something?

Any help is always appreciated... thanks :)

Comments

  • cbtcbt Member Posts: 644
    For the 1st one;

    What you are doing should be working but try this to make sure everything else is valid.

    game.score + [ (game.Redactive * 10) * (game.Redactive*10) ]

    That is solid and fail-safe.
  • FallacyStudiosFallacyStudios Member Posts: 970
    Ya that's a good idea. Guess I'll have to go with that then ;p
  • FallacyStudiosFallacyStudios Member Posts: 970
    Is it possible that it's a bug? The only thing I thought may actually be effecting it was the fact that I set Redactive back to 0 after it sets the score. Even with the solution you offered (which mathmatically should work just fine) still displays score as a zero. It's really confusing as to why it wont work because everything else is still showing up and working as it should the score just wont increment off of that or the pow code (the other one I used previously still adds 10 to the score with the other colors)
  • cbtcbt Member Posts: 644
    Hah!
    :D
    It happens to me all the time. You probably have constrain instead of change.

    :D
  • FallacyStudiosFallacyStudios Member Posts: 970
    ... This just gets more confusing. I don't have any other place changing score except where the code I'm talking about is, yet I'm finding that it increases score by 10 regardless on popping a bubble. I tried setting game.score to game.score+100 and still not working, but increasing it by 10 still.
  • FallacyStudiosFallacyStudios Member Posts: 970
    Nah it really is Change Attribute just checked :(
  • cbtcbt Member Posts: 644
    Damn, I was really sure it was that..

    Go to attributes, select "score" and press the minus ( "-" ). It will pop a screen listing which actors using it. Just check you don't have anything unexpected..
  • FallacyStudiosFallacyStudios Member Posts: 970
    Oh that's interesting I didn't know you could do that. Well I did get it to work out after all. Honestly I still can't explain why it works and the exact same set up with game.Score to game.Score+100 didn't work. I had to make the attribute change look like this game.Score to game.Score + (pow((game.Red Active *10),2))... without the () around pow it didn't work correctly either.

    One of my errors (but it didn't fix it till I did that exact format above) was that I had it in a timer that was happening after .3. But like I said even after taking one of the colors out to test out what was going on it was still not working. Very curious it is. Thanks for sticking around and helping cbt.
  • FallacyStudiosFallacyStudios Member Posts: 970
    Hey btw. Is there a way to do Score: game.score inside the same Display Text? I thought Score:..game.Score would work, but it says Invalid Expression. (Atleast I thought that's what the wiki said .. was for.
  • FallacyStudiosFallacyStudios Member Posts: 970
    Nevermind I just needed quotes around the text part.
  • cbtcbt Member Posts: 644
    You're welcome.. I always intend to help people but never can :D

    Anyways I'm happy you solved it. Good luck with your project.
Sign In or Register to comment.