Exact pixel

arvanitisarvanitis Member Posts: 26
edited November -1 in Working with GS (Mac)
Can anyone knows this?
I have an actor 150x50 pixels. I want to know the current pixel a ball bouncing on this actor. Is it possible?
Thank you

Comments

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Sorry, I have no idea what you are asking, but i can tell you the image is at a bad dimension. The images should be divisible by 2. 150x50 can potentially look bad when you put it on the stage. Half of 150 is 75, and half of 50 is 25. Neither of those is divisible by 2, you might want to consider changing the original actor size.

    Are you asking how to determine the pixel location of the actor on the stage?
  • arvanitisarvanitis Member Posts: 26
    Yeah, I know I am just testing. What exactly I want...
    a ball coming to the Actor 1, it hits it and bounce. I want to know the moment when hits the Actor 1, what pixel of this actor1 hits eg the 5th pixel, the 35th... I want, relevant to the side the ball hits, to change the angle of the bounce.
    Thank you
  • StuartYStuartY Member Posts: 134
    Here's a suggestion:

    First, lets say your example is a falling ball and a horizontal trampoline at the bottom of the screen. You need to set up a variable, call it TRAMPX. Then constrain TRAMPX to the X position of the trampoline. Set up a collision rule between the two actors, on the Ball. When it collides, subtract the difference between variable TRAMPX and the balls X position. If the ball is to the left of the center of the trampoline, this will give a +ve number. If it is to the right, it will give a negative number. This will tell you how many pixels away from the CENTRE of your trampoline your ball actor is when it collides. Now adjust the angle of the ball using this result (TRAMPX-self.position.x). You might have to do some math, e.g. to swap signs or introduce a multiplier depending on what effect you want to achieve.
Sign In or Register to comment.