Skip to content

Instantly share code, notes, and snippets.

View dimmduh's full-sized avatar
🎮
Learning Unity

Dmitrii Dukhnich dimmduh

🎮
Learning Unity
View GitHub Profile
private void copyDataBase() throws IOException{
// Path to the just created empty db
String outFileName = DB_PATH + DB_NAME;
//Open the empty db as the output stream
OutputStream myOutput = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
generator.enemies = {
{ t = 1000, enemyType = 'worm' },
{ t = 3000, enemyType = 'worm' },
{ t = 6000, enemyType = 'worm' },
{ t = 10000, enemyType = 'worm' },
{ t = 10000, enemyType = 'worm' },
{ t = 12000, enemyType = 'worm' },
}
--usefull functions
function p(t)
print( t )
end
--@see http://lua-users.org/wiki/MathLibraryTutorial
math.randomseed( os.time() )
_W, _H = display.contentWidth, display.contentHeight
--генератор врагов в точке респауна
--создает экземпляры объектов в необходимое время
EnemyGenerator = {}
function EnemyGenerator:new(params)
local generator = {}
--координаты появления
generator.x = params.x
function bullet:enterFrame(e)
if (self.destroyed) then
self:destroy()
return true;
end
if ( self:isOut() ) then
self.destroyed = true;
end
function bullet:enterFrame(e)
if ( self:isOut() ) then
self:destroy();
end
...
self:checkCollision()
end
function bullet:enterFrame(e)
if ( self:isOut() ) then
self:destroy();
return true;
end
...
self:checkCollision()
end
<?php
//парсинг баша.орг.ру
#error_reporting(0);
set_time_limit(0);
ini_set('memory_limit', '512M');
$db = new SQLite3('bash');
#$db->query('DELETE FROM quotes;');
function bullet:enterFrame(e)
if (self.destroied ) then
self:destroy()
return true;
end
--check self is out of screen
if ( self:isOut() ) then
self.destroied = true;
return true;
/**
* Виджет-блок с новостями, полученными по rss
*/
public function widgetAction()
{
require_once('Zend/Feed.php');
try
{
$feed = Zend_Feed::import('http://www.sports.ru/rss/all_news.xml');