Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="http://koda.nu/simple.js">
- var cat = {x: 100, y: 100, speed :10};
- function update() {
- clearScreen();
- hideMouse();
- if(keyboard.a) {cat.x -= cat.speed;}
- if(keyboard.d) {cat.x += cat.speed;}
- if(keyboard.w) {cat.y -= cat.speed;}
- if(keyboard.s) {cat.y += cat.speed;}
- circle(cat.x, cat.y, 20, "black");
- circle(mouse.x, mouse.y, 20, "grey");
- if(distance(cat.x, cat.y, mouse.x, mouse.y) < 40)
- {
- stopUpdate();
- showMouse();
- text(mouse.x, mouse.y, 50, "The cat wins!", "green");
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment