Skip to content

Instantly share code, notes, and snippets.

View figengungor's full-sized avatar

Figen Güngör figengungor

View GitHub Profile
@figengungor
figengungor / gist:5745882
Last active December 18, 2015 07:19
Countdown App 2, with timer.performWithDelay() and transition.to()
--CountDown App 2
W=display.contentWidth/2
H=display.contentHeight/2
local time = 3 -- count down from 3
local gogogo = display.newText("Go go go!", 0, 0, "James Fajardo", 100)
gogogo.alpha=0 --is not visible
gogogo.x=W
gogogo.y=H
local timeSound=audio.loadSound("button.wav")
@figengungor
figengungor / gist:5774390
Last active December 18, 2015 11:18
scene1
local storyboard = require ("storyboard") --import storyboard
local scene = storyboard.newScene() --create a new scene
function scene:createScene(event) --create your objects here
local group = self.view --In scene's view, we'll add(insert) our display objects
time = 3 -- count down from 3
--Text will be displayed when time is up!
gogogo = display.newText("Go go go!", 0, 0, "James Fajardo", 100)
@figengungor
figengungor / gist:5774460
Created June 13, 2013 15:09
storyboard main
local storyboard = require("storyboard") --import storyboard
storyboard.purgeOnSceneChange=true --clean scene before moving anothe scene
--GLOBALS--
W=display.contentWidth
H=display.contentHeight
-----------------------------
--Change scene--
storyboard.gotoScene("scene1") --go to first scene
@figengungor
figengungor / gist:5774700
Created June 13, 2013 15:36
director main
local director = require("director") --import director
--GLOBALS--
W = display.contentWidth
H = display.contentHeight
--Change Scene--
director: changeScene("scene1") -- go to first scene
@figengungor
figengungor / gist:5774745
Created June 13, 2013 15:41
director scene1
module(..., package.seeall)
local director = require("director")
function new() --all objects and functions should be inside this function
local group = display.newGroup() --create a group object to keep display objects
time = 3 -- count down from 3
--Text will be displayed when time is up!
gogogo = display.newText("Go go go!", 0, 0, "James Fajardo", 100)
@figengungor
figengungor / drag.lua
Created June 13, 2013 22:16
Dragging a display object in Corona
-- create object
local myObject = display.newRect( 0, 0, 100, 100 )
myObject:setFillColor( 255 )
-- touch listener function
function myObject:touch( event )
if event.phase == "began" then
self.markX = self.x -- store x location of object
self.markY = self.y -- store y location of object
elseif event.phase == "moved" then
@figengungor
figengungor / dragfocus.lua
Created June 14, 2013 20:59
Add focus to drag code so the objects won't interfere with each other while dragging on the screen.
-- create objects
local rect1 = display.newRect( 0, 0, 100, 100 )
local rect2 = display.newRect(300,300, 50,50)
-- touch listener function
local function move(self, event )
if event.phase == "began" then
--set focus on touched object so it won't interfere with other display objects.
display.getCurrentStage():setFocus( self, event.id )
self.isFocus = true
@figengungor
figengungor / Lesson2FinalCode
Created August 8, 2013 18:55
CS253 Udacity
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@figengungor
figengungor / Lesson2FullCode
Created August 8, 2013 19:13
CS253 Udacity
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@figengungor
figengungor / Rot13.py
Created August 8, 2013 23:16
CS253 Udacity Problem Set 2
import webapp2,cgi
form='''<form method="post">
<textarea name="text">
%(text)s
</textarea>
<input type="submit">
</form>
'''