1 Dec 2009 03:32
Re: Collision detection, only one object detects the collision
On Tuesday 01 December 2009 04:12:58 am Carl Cravens wrote: > > What if the bullet does a "I'm not over the background" test? > > > > But yes, in general Etoys is set up not to make things pretty but to > > allow the principles to be applied directly. > > My nine-year-old likes "pretty". He wants to write Flash games, but > getting the tools set up on Linux to achieve "hello world" seems to be a > monumental task. :) You have to make sure that your son is at a stage where he can handle thoughts like "If I were a bullet what would I do....?". Etoys can then enable him to translate those "whens" and "ifs" into a script. The goal here is not so much to create a full-fledged game but to motivate, enable and strengthen such ways of thinking. The output may look crude to people used to flashy (pun intended(Continue reading)) games but its author would have learnt many concepts in the process. Etoys is like dumbbells for brain cells. In this particular case, create a uniquely colored marker morph (normally hidden) and have the bullet "show" it at a hit spot when collision is detected. Other objects can detect overlap with marker's color, hide it and then trigger an 'explosion' script. Tip: do not use the test "overlaps color" directly in all scripts to detect collisions. Use a separate script "collision" for the test block and then call it from other scripts. When you decide to change the colors, only one script needs to be changed. A good opportunity to introduce the concept of "hiding implementations". Subbu
) games but its author would have learnt many concepts in the process.
Etoys is like dumbbells for brain cells.
In this particular case, create a uniquely colored marker morph (normally
hidden) and have the bullet "show" it at a hit spot when collision is
detected. Other objects can detect overlap with marker's color, hide it and
then trigger an 'explosion' script.
Tip: do not use the test "overlaps color" directly in all scripts to detect
collisions. Use a separate script "collision" for the test block and then call
it from other scripts. When you decide to change the colors, only one script
needs to be changed. A good opportunity to introduce the concept of "hiding
implementations".
Subbu
RSS Feed