GlyEngine 0.0.18
Create games and apps with lua
Loading...
Searching...
No Matches
2 Games

@two_games

https://two_games.gamely.com.br

Precondition
require math.random i18n math
Author
RodrigoDornelles
Version
1.0.0
Brief

play asteroids and pong in the same time

See also
Ping Pong
AsteroidsTV
Source Code
local function load(std, game)
local game1 = std.node.load('samples/pong/game.lua')
local game2 = std.node.load('samples/asteroids/game.lua')
game.toggle = false
game.ui_split = std.ui.grid('2x1')
:add(game1)
:add(game2)
:apply()
std.node.pause(game.ui_split:get_item(2), 'loop')
end
local function key(std, game)
if std.key.press.b then
local to_pause = game.ui_split:get_item(game.toggle and 2 or 1)
local to_resume = game.ui_split:get_item(game.toggle and 1 or 2)
std.node.pause(to_pause, 'loop')
std.node.resume(to_resume, 'loop')
game.toggle = not game.toggle
end
end
local P = {
meta={
title='2 Games',
author='RodrigoDornelles',
description='play asteroids and pong in the same time',
version='1.0.0'
},
config={
require='math.random i18n math'
},
callbacks={
key=key
}
}
return P;
local function title(window_name)
local function pause()
local function add(src)
local function resume(application, key)
enable node callback
local function load(application)
create new node
local function get_item(id)