Skip to main content

Posts

Showing posts with the label collisions

(VIII) Collisions and strings: dim as string & draw string

G'day everybody! In this entry we will see the collisions, and we will use a concret one wich is the perfect superposition between two elements, as it used for pac-man and the ghosts. We have a perfect superposition when te coordinates of two elements are the same, same value for x axis and same value for y axis. Take a look at the new code of the day: Let me explain the new keywords used: dim as string  to declare a new variable that will contain an string, an string is delimited with an initial " and a final ". draw string  to draw a string on the screen at the point indicated. The sintaxis is draw string (x,y),string in our case draw string (0,h/2),message When we execute this code we can move the white square toward the other ones and the message in the screen will remember the color with which square the last collision occurs. Today's code and concepts are very important because we have an square with controlled interacti...