Little game I made: Recursive Tic Tac Toe #50
SomeUnusualGames
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
That's great, thanks for sharing! You don't need to call drawImage at all, that is all handled in drawTile, and you can change the size. In draw tile size is the size in world space and tileSize is the size of tile in pixels. There is also a function for drawing stroked text, basically the same as the code you wrote but you can call drawText to simplify. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I remember finding this library in a post made on r/gamedev almost 2 years ago, when I think the repo had <100 stars. I really liked how the examples were easy to read, so I gave it a try.
It was my first non-trivial JS project, so the code may not be the most optimal, still the game works pretty well.
Gameplay video, you can see I'm using a really old version of littlejs
recursive_tictactoe_littlejs.mp4
(has sound)
This code sat still on my computer all this time and I completely forgot about it. The lib version is 1.1.1, so it's extremely ancient.
I really like how I implemented the buttons on the menu, the file that implements it is only 64 lines of code, and you can see it changes when hovering and clicking it:
Code
Rectangle
is a class with a simple collision detection with the mouse.Button gif
Again, I'm not an expert in js, this could probably be done better, especially with the newer releases.
(I used mp3 files for the sounds because, according to this it's the only one supported by IE, idk why would anyone want to support that old browser in the current year...)
The only thing that I remember bothering me (kind of) at the time was the fact that I had to use
overlayContext.drawImage()
if I wanted to draw something with a different size than the tiles image, e.g the little games shown to the sides in the menu, but I guess the library was designed that way.Maybe at some point I'll upload it somewhere and open source it, but I have a couple of bugs to fix and also upgrade littlejs to the newest version.
Really good library, simple to use and let's you make really cool stuff :)
Beta Was this translation helpful? Give feedback.
All reactions