Skip to content

Instantly share code, notes, and snippets.

View barinbritva's full-sized avatar
🏴‍☠️
Karibu!

barinbritva

🏴‍☠️
Karibu!
View GitHub Profile
@barinbritva
barinbritva / objectEntries.ts
Created March 13, 2023 12:24
typesafe objectEntries
// https://stackoverflow.com/a/74891854/3359277
export function typeSafeObjectEntries<
T extends { [key: string | number | symbol]: unknown },
K extends keyof T,
V extends T[K]
>(o: T) {
return Object.entries(o) as unknown as [K, V][];
}
@barinbritva
barinbritva / flappy-article.md
Last active February 7, 2024 08:11
flappy bird article

TON blockchain for games

What’s in the tutorial

In this tutorial we will consider how to add TON blockchain to a game. For our example we will use a Flappy Bird clone written in Phaser and will add GameFi features step by step. In the tutorial we will use short code pieces and pseudocode to make it more readable. Also, we will provide links to real code blocks to help you understand better. The whole implementation can be found in the demo repo.

Flappy Bird game without GameFi features

We are going to implement the following:

  • Achievements. Let’s reward our users with SBTs. Achievement system is a great tool to increase user engagement.
  • Game currency. In TON blockchain it’s easy to launch your own token (jetton). The token can be used to create an in-game economy. Our users will be able to earn the game coins to spend them later.