Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
BitManip
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Essex
Posted: 24th Dec 2017 11:28
Hi All Crimbo Coders

Been away for a long while but just started playing with AppGameKit again! Have a question for physics heads. Making a brick breaker game and the ball is using physics (thought it would be more 'real')! However, no matter what I do and what values I use, the ball only ever moves at one speed?



No matter what value I make fXVelocity# the speed remains the same? I want to be able to speed up and slow down the ball based upon bricks hit!


Thank in Advance and Merry Christmas
I control all the juicy in here!
puzzler2018
User Banned
Posted: 24th Dec 2017 11:35
are you de/incrementing fVelocity# somewhere else in your code?

BitManip
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Essex
Posted: 24th Dec 2017 11:37
Hi puzzler

Nope...it is a constant value?

And if I set it to 150 or 950...result is the same?

I control all the juicy in here!
BitManip
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Essex
Posted: 24th Dec 2017 11:39
Set Up For Sprite

I control all the juicy in here!
puzzler2018
User Banned
Posted: 24th Dec 2017 11:51
Hi

You do have to de/increase it



D
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 24th Dec 2017 22:41
I try not to fiddle with moving objects too much.
what you can do is set the restitution (bounciness) of the walls
SetSpritePhysicsRestitution( iSpriteIndex, restitution )
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Dec 2017 23:41
i think you should give tha ball an impulse at collision hit to speed it up.
SetSpritePhysicsAngularImpulse ( iSpriteIndex, impulse )
SetSpritePhysicsImpulse ( iSpriteIndex, x, y, vx, vy )

and you should not overwrite the Velocity.

and you should disable the default walls at screenborder and replace it with own physic sprites.
in past the sprites not bounced from.
SetPhysicsWallBottom ( mode )
SetPhysicsWallLeft ( mode )
SetPhysicsWallRight ( mode )
SetPhysicsWallTop ( mode )

i believe Restitution is the energy transfer between two masses. (momentum transfer?)



AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Dec 2017 21:34
Quote: "i believe Restitution is the energy transfer between two masses. (momentum transfer?)"


I believe it will do what they want. I have just used it in my pinball app and it's perfect for increasing the bounciness of an object. The doco even uses the word bounciness
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 31st Dec 2017 12:30

Login to post a reply

Server time is: 2024-04-26 10:10:40
Your offset time is: 2024-04-26 10:10:40