Would my rule go like this?

CoolBeeCoolBee Member Posts: 81
I am wanting to increase the Y axis for a brief second on touch of the screen to make a bird flap to a power meter, so should I create a touch box over the screen and have it as;

When actor receives touch, change attribute - game.bird -> game.position.Y +50
And also have Acceleration 90/270

I'm not 100% sure on how to do the power meter, as I want the power meter on screen to give say 5 flaps before it runs out but it needs to replenish slowly, so firstly am I correct in thinking I need to make an empty power bar on screen then... Hmmm I don't know where to go, what do I do with the inside 'power' sprites?

Comments

  • NovicaStudioNovicaStudio Member Posts: 174
    1) Your rule for the touch is correct. Make sure that you do self.position.y -> self.position.y + 50, not the game.____. the 270 is correct for gravity. I'd also suggest to change the rule of the change attribute to an interpolate behavior. THen it would look a lot smoother. Interpolate position of bird to position+50 for half a second or so.

    2) In terms of the flap meter, I'd make an integer attribute called power. Have it start at 5(or how many flaps before loss of stamina) and then have you lose one power whenever you touch and make the bird fly. From there, you can have it recharge in these two ways:

    a) Have a rule- if game.power < 5 then every 5 seconds change attribute game.power to game.power + 1. This will just make it so that if you aren't at full power, you will recharge.
    b) If you want something where after those 5 you have to wait, then you can make this rule- If game.power=0 then after 5 seconds change attribute game.power to 5.


    These are just a few ways. Please clarify otherwise if this is not what your were asking.
  • CoolBeeCoolBee Member Posts: 81
    Sound pretty much perfect thank you very much just need to get home and test it! I hate being at work or not at home when I have & want to try/test ideas!
  • CoolBeeCoolBee Member Posts: 81
    @NovicaStudio I did what you said for the self position like this http://i40.tinypic.com/wnz1x.png but the actor shoots up the screen never to be seen again? I tried it with and without the timer but it didn't seem to make much difference?
  • NovicaStudioNovicaStudio Member Posts: 174
    Your conditions for the rule to work (essentially the if game.jump) is not what it should be. Have it so that when touch is pressed, interpolate. Do not have the change attribute as well.

    If its not working please tag me like you did before and I will get back to you.
Sign In or Register to comment.