1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>nothing</title>
  5. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
  6. <script src="http://gamequery.onaluf.org/download/jquery.gamequery-0.5.1.js" type="text/javascript"></script>
  7. <script type="text/javascript">
  8. $(function() {
  9. $(document).keydown(function(event) {
  10. if ( event.which == 37){
  11. $('.button0 input').animate({'left': '+='+Math.cos(90*Math.PI/180) *30+'px','top': '+='+Math.sin(90*Math.PI/180) *30+'px'},0);
  12. }
  13. });
  14. $(document).keydown(function(event) {
  15. if ( event.which == 39){
  16. $('.button0 input').animate({'left': '+='+Math.cos(180*Math.PI/180) *30+'px','top': '+='+Math.sin(180*Math.PI/180) *30+'px'},0);
  17. }
  18. });
  19. $(document).keydown(function(event) {
  20. if ( event.which == 38){
  21. $('.button0 input').animate({'left': '+='+Math.cos(270*Math.PI/180) *30+'px','top': '+='+Math.sin(270*Math.PI/180) *30+'px'},0);
  22. }
  23. });
  24. $(document).keydown(function(event) {
  25. if ( event.which == 40){
  26. $('.button0 input').animate({'left': '+='+Math.cos(0*Math.PI/180) *30+'px','top': '+='+Math.sin(0*Math.PI/180) *30+'px'},0);
  27. }
  28. });
  29.  
  30.  
  31. $('.button0 input').collision('.button1 input').each(function(){
  32. alert('COLLISION')
  33. });
  34.  
  35.  
  36. });
  37. </script>
  38. <style type="text/css">
  39. .button0 input{
  40. position:fixed;
  41. left:142px;
  42. top:77px;
  43. font-family:MS Shell Dlg 2;
  44. font-size:8px;
  45. font-weight:NORMAL;
  46. }
  47. .button1 input{
  48. position:fixed;
  49. left:333px;
  50. top:58px;
  51. font-family:MS Shell Dlg 2;
  52. font-size:8px;
  53. font-weight:NORMAL;
  54. }
  55. </style>
  56. <body>
  57. <div class="button0"><input type="button" style="width: 59px;height: 58px;" value="Button"/></div>
  58. <div class="button1"><input type="button" style="width: 113px;height: 76px;" value="Button"/></div>
  59. </body>
  60. </html>