How can I change the size of an actor with 3 buttons?

Hey all,

I want to change the size of my actor with 3 buttons :smile:

An example:
Imagine a ball that gets bigger when I press button 1 and when I press button 2 it gets bigger and when I press button 3 it gets the biggest size and it should also work in the other direction getting smaller!

So I hope you can help me with this problem!
thanks in advance

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692

    Make a game integer call it "whichButton" now in button 1 if touch is pressed change game.whichButton to 1 do the same for button 2 and 3 changing the game.whichButton to 2 and 3.

    Now in the ball actor you can do if game.whichButton = 1 interpolate size width and don't forget height to for eg 100 if whichButton = 2 interpolate sizes to 200 and so on.

    You can also use change size if you want it to instantly change size.

    Hope this helps.

    Darren.

  • Oh yes, not sure about where to put this, but as this is partially relevant, I will post here. It would be nice to be able to access attributes of other objects, not just self attributes. It would make things SO MUCH simpler and easier.

  • Mr.NonameMr.Noname Member Posts: 37

    Thanks guys :wink: @jeezzcake and @DeepBlueApps

  • Mr.NonameMr.Noname Member Posts: 37

    Hello @jeezzcake‌ you helped me a lot with the 3buttons so thanks therefore.

    My second question is how can I collide with other actors?

    So what I mean is when the ball has the biggest size and it collides or overlaps with an smaller ball I want to make it change the scene to gameover and when the ball gets his smallest size and collides with an equal sized ball to get 1 point.

    I´m new here so I hope you can help me :wink:
    thanks in advance

  • willkeslingwillkesling Member, PRO Posts: 123

    This sounds interesting. Just keep in mind that changing the size like this will not change the collision size of the object. If I remember correctly, not sure if your using collision detection in your app.

    If you are using collision, then I would have the buttons spawn a new ball actor at the new size and then destroy the ill ball. Then you can have the new object at the new size and not have to worry about the collision sizes.

  • Mr.NonameMr.Noname Member Posts: 37

    thanks @jeezzcake‌

  • Mr.NonameMr.Noname Member Posts: 37

    Hi @willkesling‌ but how can I spawn three different actors (balls) at the same place when I touch 1 button I want to change the ball and when I touch the other button I want to change the ball to a bigger size so what I mean is I want to change the picture form the balls.

    I hope you understand it and you can help me :smile:
    thanks in advance

  • willkeslingwillkesling Member, PRO Posts: 123

    @Mr.Noname well there are probably a few different ways to do this. You could create a global variable that would record the ball( which ever ball it may be ) X and Y position.

    For this example we will call this global variable BallX and the otherone BallY ( make sure you select real ) as the type.

    make a rule on the ball ( the actor in your scene ) that says with timer, every 0 seconds change global BallX to self.X and Ball.Y to self.Y

    This will give a constant update of where the ball is on the screen. Then when you span the other balls you can span at Ball.X and Ball.Y

    You might not even need the global variable. Let me sit down tonight and do a quick demo of this and I will upload it here for you to use.

  • Mr.NonameMr.Noname Member Posts: 37

    ok that would be very nice @willkesling‌ :smile:

  • Mr.NonameMr.Noname Member Posts: 37

    Hey @willkesling‌ I dont want to stress you but is the demo ready? :wink:

Sign In or Register to comment.