27 posts
• Page **3** of **3** • 1, 2, **3**

"So now I'm relearning trig so I can figure out this forum answer which three other advanced designers all agree was incredibly useful."

So saith I to my friend on gchat. I downloaded R0J0hound's capx and I understand the principle of capturing the inverse of the object's effective horizontal and vertical angles on impact, but just in case you guys can explain the math and variables faster than I can figure it out myself:

1) Why set the instance variables "vx" and "vy" to 100 times the cos(self.Angle)?

2) Is "dt" an established variable I should know about, and what is it?

3) How did you create the "move horizontally" and "move vertically" events? I don't see a condition for

*Ball* -> *Set X to* -> self.X + self.vx * dt

Thanks anyone who can help!

-RE

So saith I to my friend on gchat. I downloaded R0J0hound's capx and I understand the principle of capturing the inverse of the object's effective horizontal and vertical angles on impact, but just in case you guys can explain the math and variables faster than I can figure it out myself:

1) Why set the instance variables "vx" and "vy" to 100 times the cos(self.Angle)?

2) Is "dt" an established variable I should know about, and what is it?

3) How did you create the "move horizontally" and "move vertically" events? I don't see a condition for

Thanks anyone who can help!

-RE

**Posts:**366**Reputation:**12,143

B

52
S

15
G

11
Urrgh, lost my post. :/

Summed up : Rojo is awesome.

1.) the number is the speed at which the balls move (X and Y movement), if you play around with the numbers you can slow them down or speed them up.

2.) dt is a reliable way to time something so it will act the same across platforms. (If you add dt to a global variable every tick for instance - it will count up like a stop watch). Not sure what the exact dt to time ratio is though.

3.) Its done in event 1. The X and Y speed are set to variables, and in the events below the balls are told to stick to the X and Y movements of the variables.GenkiGenga 2012-09-25 04:06:49

Summed up : Rojo is awesome.

1.) the number is the speed at which the balls move (X and Y movement), if you play around with the numbers you can slow them down or speed them up.

2.) dt is a reliable way to time something so it will act the same across platforms. (If you add dt to a global variable every tick for instance - it will count up like a stop watch). Not sure what the exact dt to time ratio is though.

3.) Its done in event 1. The X and Y speed are set to variables, and in the events below the balls are told to stick to the X and Y movements of the variables.

**Posts:**1,070**Reputation:**13,039

B

121
S

23
G

7
1) 100 is the speed to move and the angle is the direction.

The formula is a conversion to horizontal and vertical motion.

http://www.teacherschoice.com.au/maths_library/coordinates/polar_-_rectangular_conversion.htm

2) dt is the amount of time that the current frame is taking. In the example dt is used for time in this simple formula:

[code]speed * time = distance[/code]

More info about dt:http://www.scirra.com/tutorials/67/delta-time-and-framerate-independence

3) I'm not quite sure what you're asking, "set x" and "set y" are actions not conditions. The rest of it is just a formula.

The formula is a conversion to horizontal and vertical motion.

http://www.teacherschoice.com.au/maths_library/coordinates/polar_-_rectangular_conversion.htm

2) dt is the amount of time that the current frame is taking. In the example dt is used for time in this simple formula:

[code]speed * time = distance[/code]

More info about dt:http://www.scirra.com/tutorials/67/delta-time-and-framerate-independence

3) I'm not quite sure what you're asking, "set x" and "set y" are actions not conditions. The rest of it is just a formula.

**Posts:**5,280**Reputation:**69,971

B

92
S

32
G

107
GenkiGenga and R0J0hound, thanks a ton for the clarification!

To explain my confusion on item 3, Event 1 has a condition, "System: On Start of Layout" before the associated action, whereas it appears that Event 2 is just the action with no corresponding condition, and is linked to action 3 which *does* have a condition, i.e., "Ball: Is Overlapping Wall."

If I'm about to figure all that out as I finish reading the Event section of the manual, then I apologize, and I'll work it out. =)

Thanks for your time!

To explain my confusion on item 3, Event 1 has a condition, "System: On Start of Layout" before the associated action, whereas it appears that Event 2 is just the action with no corresponding condition, and is linked to action 3 which *does* have a condition, i.e., "Ball: Is Overlapping Wall."

If I'm about to figure all that out as I finish reading the Event section of the manual, then I apologize, and I'll work it out. =)

Thanks for your time!

**Posts:**366**Reputation:**12,143

B

52
S

15
G

11
hello,

this is the easy to use step to make bouncing ball.

1. Make objects (sprites) that your ball will bounce when she collide with

2. Add Bullet behavior to your ball.

3. In objects properties, change values to:

- Speed to 400 or any

- Acceleration & Gravity to 0.

- Bounce of solids to YES (this make ball bouncing when hit solids

objects)

enjoy it.

this is the easy to use step to make bouncing ball.

1. Make objects (sprites) that your ball will bounce when she collide with

2. Add Bullet behavior to your ball.

3. In objects properties, change values to:

- Speed to 400 or any

- Acceleration & Gravity to 0.

- Bounce of solids to YES (this make ball bouncing when hit solids

objects)

enjoy it.

2D Game GUI Designer

**Posts:**130**Reputation:**3,778

B

12
S

4
G

3
27 posts
• Page **3** of **3** • 1, 2, **3**

## Who is online |

Users browsing this forum: atmas, David181, OBLIVION and 19 guests |