Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@AGulev
AGulev / delete_duplicate_sprites_in_atlases.py
Last active March 8, 2018 19:28
Python script for removing multi-adding same sprites to the non animated atlas in Defold project
import os, sys, hashlib
import deftree
def all_files(ending, project_root):
# Generator to get files
for root, folders, files in os.walk(project_root):
for f in files:
if f.endswith(ending):
yield os.path.join(root, f)
@AGulev
AGulev / FBInstant.d.ts
Created March 15, 2018 14:51
Type definitions for FBInstant v2.1 (deprecated)
// Type definitions for FBInstant v2.1
// Api documentation : https://developers.facebook.com/docs/games/fbinstant-api
//
/**
* Top level namespace for the Instant Games SDK.
*/
declare var FBInstant:fbinstant.IFBInstant;
declare namespace fbinstant
{
@AGulev
AGulev / style-guide.md
Created April 27, 2018 16:11 — forked from dapetcu21/style-guide.md
Interrogation Style Guide

Lua style guide

Linting

This project makes use of [Luacheck] for catching common mistakes. Install it and configure it for your text editor.

Editor configuration

We recommend [Atom] for editing Lua code along with the following packages:

  • [linter-luacheck]: [Luacheck] integration
@AGulev
AGulev / builder.py
Created April 28, 2018 10:49 — forked from Jerakin/builder.py
For building and deploying Defold projects directly to your phone
"""
Builder is built by wrapping adb and storing some data locally
I would recommend to add an alias to your ~.bash_profile to use it easier
alias builder="python3.5 ~/Documents/repo/builder/builder.py"
Usage:
builder.py [command] [arguments]
Available Commands:
@AGulev
AGulev / gist:f1d4ad5d695211cc27b7f11490fa96fb
Last active April 13, 2019 20:25
Exchange rate National Bank of the Republic of Belarus in Google Sheets
Формула:
=IMPORTXML(CONCATENATE("http://www.nbrb.by/Services/XmlExRates.aspx?ondate=", TEXT(A1,"mm/dd/yyyy")),"/DailyExRates/Currency[@Id='145']/Rate/text()")
Нужно заменить A1 ячейкой с датой.
Валюты:
145 - USD
292 - EUR
298 - RUB
function M.check_keys(callback)
local max_keys = data.BALANCE.CONST.max_key_counts[wallet.max_key_index]
if wallet.keys < max_keys then
local dif = 0
local time_key
if uptime then
time_key = "last_key_use_time_cpu"
dif = uptime.get() - wallet.last_key_use_time_cpu + 1
end
if dif <= 0 then
@AGulev
AGulev / iaps.lua
Last active December 14, 2021 12:53
local cfg = require "modules.onet.config"
local msgs = require "modules.msgs"
local M = {}
local list = {}
local callback_function
local function iap_listener(self, transaction, error)
if error == nil then
Here is a simple manual about how to make a simple flappy bird-like game on Defold with code examples:
* A flappy bird-like game is a game where you have to control a bird that flies through gaps between pipes. The bird falls down because of gravity, but you can make it flap its wings and go up by tapping the screen or pressing a key. The game ends when the bird hits a pipe or the ground. The goal is to fly as far as possible and get a high score.
* To make a flappy bird-like game on Defold, you need to do these steps:
* Create a new project in Defold and name it “Flappy Bird”.
* Create a new collection file and name it “main.collection”. This will be the main scene of your game.
* Create a new game object file and name it “bird.go”. This will be the bird that the player controls.
* Add a sprite component to the bird game object and set the image to a bird image of your choice. You can use the built-in “hero.atlas” or import your own image.
* Add a script component to the bird game object and name