Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ged-odoo committed Sep 18, 2024
1 parent 5a85cef commit 46a6b8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 3_build_a_clicker_game.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ features to it.
- [5. Use a custom hook](#5-use-a-custom-hook)
- [6. Humanize the displayed value](#6-humanize-the-displayed-value)
- [7. Add a tooltip in ClickValue component](#7-add-a-tooltip-in-clickvalue-component)
- [8. Buy ClickBots](#8-buy-clickbots)

## 1. Create a systray item

Expand Down Expand Up @@ -177,3 +178,23 @@ interface. Let us display the real number as a tooltip.

**See also:**
[Documentation in the tooltip service](https://github.com/odoo/odoo/blob/c638913df191dfcc5547f90b8b899e7738c386f1/addons/web/static/src/core/tooltip/tooltip_service.js#L17)

## 8. Buy ClickBots

Let us make our game even more interesting: once a player get to 1000 clicks for
the first time, the game should unlock a new feature: the player can buy robots
for 1000 clicks. These robots will generate 10 clicks every 10 seconds.

1. Add a `level` number to our state. This is a number that will be incremented
at some milestones, and unlock new features
2. Add a `clickBots` number to our state. It represents the number of robots
that have been purchased.
3. Modify the client action to display the number of click bots (only if
`level >= 1`), with a `Buy` button that is enabled if `clicks >= 1000`. The
`Buy` button should increment the number of clickbots by 1.
4. Set a 10s interval in the service that will increment the number of clicks by
`10*clickBots`.
5. Make sure the `Buy` button is disabled if the player does not have enough
clicks.

![Clickbot](_images/clickbot.png)
Binary file added _images/clickbot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 46a6b8d

Please sign in to comment.