This site requires JavaScript, please enable it in your browser!
Greenfoot back
camsterb
camsterb wrote ...

2012/12/17

Ice Hockey Game Questions

camsterb camsterb

2012/12/17

#
I'm doing a big project in college to make an Ice Hockey game. I'm not looking for any code, but just an idea about how to make a character slide? I hold a button to make them start moving in a direction. When I let go of the button, they will continue moving in the same direction but lose velocity. Ideas?
danpost danpost

2012/12/17

#
Use a 'double' to control the velocity of the character. In the 'act' method subtract a fractional amount from the velocity. Determine the change in x and y each act cycle by converting the velocity and rotation using 'sin' and 'cos'. If you find you are having trouble with it, check out my Teleport Demo scenario which incorporates a slow-down feature (even though there really is no slowing down when in space).
camsterb camsterb

2012/12/17

#
Great. This should help a lot. Thank you again.
camsterb camsterb

2013/1/9

#
Hey, again. I have posted another two discussions with questions about collisions if you can help. Thanks. http://www.greenfoot.org/topics/find/17806#post_17806 http://www.greenfoot.org/topics/2775
You need to login to post a reply.