Skip to content

Instantly share code, notes, and snippets.

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
@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
@AGulev
AGulev / swipe_mouse.lua
Created July 29, 2016 06:25
adoptation of swipe-direction script by ScottPhillips https://github.com/ScottPhillips/swipe-direction/blob/master/swipe-direction.lua for Defold engine using mouse_trigger instead touch_trigger
local beginX
local beginY
local endX
local endY
local startTime = 0
local xDistance
local yDistance
@AGulev
AGulev / swipe.lua
Last active November 22, 2021 15:54
adoptation of swipe-direction script by ScottPhillips https://github.com/ScottPhillips/swipe-direction/blob/master/swipe-direction.lua for Defold engine
local beginX
local beginY
local endX
local endY
local startTime
local xDistance
local yDistance
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 / duplicates_finder.py
Last active September 1, 2021 05:34
Python script for a searching duplicate files in folder. Modification of: https://www.pythoncentral.io/finding-duplicate-files-with-python/ (file size counter was added)
# dupFinder.py
import os, sys, stat
import hashlib
def findDup(parentFolder):
# Dups in format {hash:[names]}
dups = {}
for dirName, subdirs, fileList in os.walk(parentFolder):
print('Scanning %s...' % dirName)
for filename in fileList:
@AGulev
AGulev / bundle.sh
Last active December 10, 2020 13:45 — forked from britzl/bundle.sh
Script to build and bundle a Defold project for multiple platforms
#!/bin/bash
readonly java_path='java'
readonly output_path='build'
readonly email='my@email.com'
readonly auth_key='my_key'
readonly texture_compresstion='false'
readonly andr_key_path='key.pk8'
readonly andr_cert_path='certificate.pem'
@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
std = "max"
files['.luacheckrc'].global = false
unused_args = false
globals = {
"sys",
"go",
"gui",
"label",
"render",
@AGulev
AGulev / CustomEditorBase.cs
Created April 3, 2016 17:15 — forked from t0chas/CustomEditorBase.cs
Default Custom Inspector-Editor for Unity3D with ReorderableLists for arrays handling
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor
{