Clicker Style Game

Monkey Forums/Monkey Programming/Clicker Style Game

ewancordiner(Posted 2016) [#1]
So far all I have done is programmed an incremental counter in the top left corner and each time the user clicks on the screen, this goes up by one. i was wondering if it was possible to use the users mouse coordinates as the pixels to output the Draw Text to. Such as where the user clicked it would cause a +1 to appear briefly etc. Any advice would be great, thankyou :).


Shockblast(Posted 2016) [#2]
You can use MouseX() and MouseY() to get the mouse coordinates. You can then use those coordinates in the DrawText() function.


ewancordiner(Posted 2016) [#3]
I thought as much but just can't seem to implement this and it work, I'll give it another bash today though!


Phil7(Posted 2016) [#4]
Hi, seems you are just starting. Here is a simple way to do this. Hope this is what you meant.




ewancordiner(Posted 2016) [#5]
Thankyou, I've managed this now. Also, I was wondering how to first of all change it to run in google chrome as opposed to IE and also if there was a way to change the canvas size of the game?


Phil7(Posted 2016) [#6]
For html5 Monkey just uses your standard browser as far as I know.
Canvas size can be changed easily by editing the MonkeyGame.html file in the *.build*/html5 folder in .
It is this line at the beginning of the body part: <div><canvas id="GameCanvas" width=640 height=480 tabindex=1></canvas></div>

There is also a way to make a custom target for html (forum search ;-) ), so it doesn't fall back to default, if you build from scratch.

btw most of your questions are allready answered in this forum. Good luck!