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.

AppGameKit Classic Chat / physics starting out

Author
Message
malospam
13
Years of Service
User Offline
Joined: 27th Aug 2011
Location: Florida
Posted: 29th Aug 2011 22:41
I was wondering if anybody could recomend me and where to start for simulating something similar to a person hitting a ball over the net like in tennis or volleyball or something similar. I'm reading through all the physics modules as much as possible, but I'm not sure where to start, such as should I use the built in physics, ie will that work, or am I going to have to do it from ground up. Any suggestions would be great, thanks!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 30th Aug 2011 03:37 Edited at: 30th Aug 2011 03:38
That would like be the MAX! lol

I'll play with the volley ball or tennis tomorrow, and let you know how it goes. (AGK is on my computer at work)
The graphics will be lacking though, but the code is the main thing anyway.
Then, on to the horseshoes.

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 30th Aug 2011 22:14 Edited at: 30th Aug 2011 22:37
Here you go Max.
The ZIP file is attached and it has the main.agc and the media included.
Nothing fancy here, just a simple example for applying the forces to the ball.
I did not animate any sprites just tot save time, so the players slide.
I could have used a FOR NEXT loop for the player collisions, but I did it straight forward thinking the differences would be easier to see.
I know my code for this is sloppy, but it was whipped up in a hurry, so...
I hope this helps.

OOOPS
I forgot to tell you...
the A and D keys are for blue players movement.
the Left and Right Arrow keys are for the red players movement.




P.S.
I used the ball that was included with AppGameKit, so I hope it is okay to redistibute it here for an example. (edited the color though)
If not, then a mod can post here and I will swap it out for a different ball.



Attachments

Login to view attachments
malospam
13
Years of Service
User Offline
Joined: 27th Aug 2011
Location: Florida
Posted: 30th Aug 2011 22:34
dude you are awesome, I will definitely give you credit if I come out with something good, which I should. stay tuned!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 30th Aug 2011 23:46 Edited at: 30th Aug 2011 23:49
Here is a screenshot of my next game... (I was supposed to have worked on it today)





malospam
13
Years of Service
User Offline
Joined: 27th Aug 2011
Location: Florida
Posted: 1st Sep 2011 19:55
The new update messed it up and the ball doesn't go any where any more, anybody know why, and how I can fix it?
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 2nd Sep 2011 03:50
I'll have to check it out tomorrow.

malospam
13
Years of Service
User Offline
Joined: 27th Aug 2011
Location: Florida
Posted: 2nd Sep 2011 16:59
That board game looks badd as-ss. Yes please check out the physics, i'm basically been stuck for a day now not being able to code anything.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 2nd Sep 2011 22:59 Edited at: 2nd Sep 2011 23:05
The volleyball example above is for Version 1028
It will not work in later versions without adjustments, as pointed out by our friend.

Quote: "That board game looks badd as-ss."

Thanks
The game is believed to be from around 2500 BC, and is also thought to be the oldest board game known to mankind.
However, the rules were lost through the ages, so I had to Conjure up a couple of spirits to teach me how to play it.
I made a little progress today, and I only have a couple more things to sort out for the player's turn.
Then, I'll need to do the NPC's (Non Player Character) turn, which will involve a little bit of logic for thr AI.
I hope to have it finished by Monday or Tuesday, but it should be done by Friday of next week at the latest.

Stay Tuned...

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 3rd Sep 2011 23:46
Quote: "The new update messed it up and the ball doesn't go any where any more, anybody know why, and how I can fix it? "


My vollyball example seems to need a 5x adjustment on velocity for version 1036...

sprite5_velocity = 60
sprite5_direction = 3

...Become...

sprite5_velocity = 300
sprite5_direction = 15

...then I adjust my formulas as so....

sprite5_direction = ((GetSpriteX (2) - 10) - GetSpriteX (5)) / 2 * -1
sprite5_direction = ((GetSpriteX (3) + 10) - GetSpriteX (5)) / 2 * -1

...Become...

sprite5_direction = ((GetSpriteX (2) - 10) - GetSpriteX (5)) * -2
sprite5_direction = ((GetSpriteX (3) + 10) - GetSpriteX (5)) * -2

...By changing these values the example should work in v1036 similar to the way the old code did in v1028.

I hope this helps.

malospam
13
Years of Service
User Offline
Joined: 27th Aug 2011
Location: Florida
Posted: 4th Sep 2011 22:59
nope its still not working. the ball clearly lands on the player initially, and after a splitsecond it bounces off, but the first time it hits and loses its momentum, it is not registering the collision. what the heck is going on here?

To the developers or anyone else who can help, is there anything else in the physics engine that might be changed that might be relevant to this issue?

Login to post a reply

Server time is: 2024-11-24 00:07:01
Your offset time is: 2024-11-24 00:07:01