A couple of things to note:
- to ensure the sound effect plays at the same time as the key is clicked we load the resource into memory instead of streaming the audio file as we did in the earlier example.
- for keymapping the 'modifiers' field indicates where Caps, Shift or Ctrl is held.
- Finally for mouse events and x and y is returned giving the location of the mouse cursor in the window when pressed.
Challenge!
Using this sounds effect, create a game that creates yellow ovals at the mirrored mouse location when the left button is pressed. I.e. if a mouse click was at (200, 100) in a 600x800 window then the 'mirrored' location should be at (600-200, 800-100).
No comments:
Post a Comment