Uploaded July 2024 | Updated September 2026, 2 weeks ago
Join me on another coding adventure as I turn my train simulation into a fun and ethical dilemma game about the trolley problem! 🚂🐱 In this video, I demonstrate how to create a game where you must divert a train to save a cat, using JavaScript and HTML Canvas. Perfect for beginners and experienced coders alike, this tutorial walks you through:
Highlights:
- Drawing and animating a train along curved tracks
- Implementing the trolley problem scenario with a cat emoji as the victim
- Using keyboard controls to switch tracks and avoid game over
- Adding a scoring system and increasing difficulty with each round
- Styling and refining the game's appearance and functionality
Try out the final game on my website and share your scores with me on Twitter or Discord. Like, comment, and subscribe for more coding projects and challenges!
GAME: radufromfinland.com/projects/trolleyproblem
Join me on another coding adventure as I turn my train simulation into a fun and ethical dilemma game about the trolley problem! 🚂🐱 In this video, I demonstrate how to create a game where you must divert a train to save a cat, using JavaScript and HTML Canvas. Perfect for beginners and experienced coders alike, this tutorial walks you through:
Highlights:
- Drawing and animating a train along curved tracks
- Implementing the trolley problem scenario with a cat emoji as the victim
- Using keyboard controls to switch tracks and avoid game over
- Adding a scoring system and increasing difficulty with each round
- Styling and refining the game's appearance and functionality
Try out the final game on my website and share your scores with me on Twitter or Discord. Like, comment, and subscribe for more coding projects and challenges!
GAME: radufromfinland.com/projects/trolleyproblem









![Text and Images on HTML Canvas
We learn how the fillText and drawImage methods work on the HTML Canvas.
Course playlist:
https://www.youtube.com/playlist?list=PLB0Tybl0UNfb6BvBPePaiCNOFpzxeE86R
⭐ MY CANVAS PROJECTS ⭐
1. Matrix Camera Effect https://youtu.be/GmB0ge-CuZo
2. Self Driving Car https://youtu.be/NkI9ia2cLhc
3. Puzzle Cam https://youtu.be/Z6fQtNpB3hU
4. Many more on my channel [ Its mostly about that :-) ] Text and Images on HTML Canvas](https://i.ytimg.com/vi/u923wu6Oa2A/mqdefault.jpg)
