Tampilkan postingan dengan label Corona. Tampilkan semua postingan
Tampilkan postingan dengan label Corona. Tampilkan semua postingan

Taking Random Values in Corona

Posted by Unknown Rabu, 06 November 2013 0 komentar
Syntax for taking random numbers or values in corona has been given below.
Download the code and try it...

Syntax
        math.random() 
        math.random( m ) 
        math.random( m, n )

math.random() ---> a number between 0 and 1
math.random(m) ---> an integer between 1 and n (inclusive)
math.random(m,n) ---> an integer between m and n (inclusive)
 

math.random() ---> a number between 0 and 1
math.random(20) ---> an integer between 1 and 20 (inclusive)
math.random(20, 40) ---> an integer between 20 and 40 (inclusive)


Baca Selengkapnya ....

Using For Loops inCorona

Posted by Unknown Selasa, 05 November 2013 0 komentar
Using For Loops in corona is very eazy.Copy and try the code below..
 
for i=1,20 do
print(i)
end

Baca Selengkapnya ....

String Functions In Corona

Posted by Unknown Sabtu, 02 November 2013 0 komentar
Here is a list of string function which are very useful...

string.byte() Returns the internal numerical codes of the characters in a string.
string.char()Returns a string in which each character has the internal numerical code equal to its corresponding argument.
string.find() Looks for the first match of a pattern in a string. If found, it returns the indices where the occurrence starts and ends; otherwise, returns nil.
string.format()Returns a formatted string following the description given in its arguments.
string.gmatch()Returns a pattern-finding iterator.
string.gsub()Replaces all occurrences of a pattern in a string.
string.len()Returns the length of a string (number of characters).
string.lower()Changes uppercase characters in a string to lowercase.
string.match()Extracts substrings by matching patterns in a string.
string.rep()Replicates a string by returning a string that is the concatenation of n copies of a specified string.
string.reverse()Reverses a string.
string.sub()Returns a substring (a specified portion of an existing string).
string.upper()Changes lowercase characters in a string to uppercase.

Baca Selengkapnya ....

Read A Text File in Corona

Posted by Unknown Minggu, 27 Oktober 2013 0 komentar
Reading a text file in corona is very eazy.First get the file path and using the file path read the content in the file. Check the code below.
  display.setStatusBar( display.HiddenStatusBar )
-- read the file path
local filePath = system.pathForFile( "myFile.txt", system.ResourceDirectory )

local file = io.open( filePath, "r" )
if file then
-- read all contents of file into a string
local contents = file:read( "*a" )

print( "The file path is" .. filePath )
print( contents )

io.close( file )

end


Copy and download the code and try your self.

Baca Selengkapnya ....

Corona - Display Groups

Posted by Unknown Kamis, 24 Oktober 2013 0 komentar

local Group1 = display.newGroup()

This creates a new display group by the name of Group1. You can then add display objects to it.You should declare them near the top of your Lua document.You should create display groups in a specific order. The first declared group will actually reside behind the next group in visually layered order.

local farBackground = display.newGroup()
local nearBackground = display.newGroup() --this will overlay 'farBackground'
local foreground = display.newGroup() --and this will overlay 'nearBackground'


Baca Selengkapnya ....

Tables In Corona

Posted by Unknown Jumat, 13 September 2013 0 komentar
The table constructor is written using braces
(curly brackets) as in { }

t = {}   -->create a table

k = "x"
t[k] = "tabvalue" --new table entry,
-->with key="x" and value=2.4

print( t[k] ) --> 2.4
print( t["x"] ) --> 2.4
print( t.x ) --> 2.4

t[2] = "tabval2" --new table entry,
-->with key=2 and value="tabval2"
t[3]= 2.4
print( t[2] ) --> "tabval2"
print( t[3] )

Baca Selengkapnya ....

Function in Corona

Posted by Unknown Kamis, 22 Agustus 2013 0 komentar
Using functions are very eazy in Lua.We can provide arguments as input (within the parentheses), the function performs some tasks, and the results can be returned.
Some ways to define functions are:
      
local function f ()
--body
end

local f = function()
--body
end

function f ()
--body
end

f = function ()
--body
end

Baca Selengkapnya ....

Types and Values In Corona

Posted by Unknown 0 komentar
Lua is a dynamically typed language. This means that variables do not have types; only values do. There are no type definitions in the language. All values carry their own type.
All values in Lua are first-class values. This means that all values can be stored in variables, passed as arguments to other functions, and returned as results.
nil — it usually represents the absence of a useful value.
boolean
 — represents two conditions 'false' or 'true'
number
 — represents real (double-precision floating-point) numbers.
string
 — represents arrays of characters. Lua is 8-bit clean: strings can contain any 8-bit character,   including embedded zeros.
function 
click here to get more details
table
 — the sole data structuring mechanism in Lua.

Baca Selengkapnya ....

Installing Corona SDK - a reference

Posted by Unknown Rabu, 21 Agustus 2013 0 komentar
Corona SDK on Windows only supports device builds for Android devices. Corona SDK on Mac OS X supports both iOS and Android development.

You can download  corona from here .....download corona
After downloading, double-click the .msi installer file and follow the steps in Corona's installation wizard.

Activating the SDK:
 In order to use the Corona SDK, you must be connected to the Internet and perform a simple one-time authorization process.

Open the Corona Simulator from the folder where you installed it. The first time you launch, you will be presented with a License Agreement (EULA). Read the license terms and clickAgree. If you've already registered for a Corona account, simply enter your account e-mail and password to activate the SDK. Otherwise, click Register to create an account.

Corona Developer Login
Upon successful login, you will receive a confirmation dialog. You're ready to get started!

Login Successful

In order to build for Android or ios you may need Android sdk or  OS X supports respectfully.

Baca Selengkapnya ....

What is Corona?

Posted by Unknown Selasa, 20 Agustus 2013 0 komentar
Corona is cross platform game engine that supports Android and iOS. It’s developed by a company named Ansca, and you can use a free trial to try out Corona and develop your game. When you are ready to publish you are required to buy a license, prices range from $199 to $349.

You program in Corona with a programming called Lua, which is a lightweight and easy to use scripting language. There is no IDE for Corona (such as Xcode), instead you often program with a normal text editor. Corona comes with a simulator you can use to test your game as you’re coding it.

Corona has built-in APIs for the normal game programming aspects (sprites, sounds, etc.) as well as various APIs from the Apple including Game Center Leaderboards (new), In App Purchase, and TableViews (new).


Baca Selengkapnya ....

Copying an Array and Sorting it in Corona

Posted by Unknown Selasa, 08 Januari 2013 0 komentar

copyarray = table.copy( randomArray)
local function compare( a, b )
return a < b
end
table.sort( copyarray, compare )

Baca Selengkapnya ....

Function to Generate a Set of Random Numbers in Corona

Posted by Unknown 0 komentar

Call this function to generate a set of five random numbers (maxRandom)...


local function generaterandom()
local maxRandom = 5
for m = 1, randCount do
randomArray[m]=-100
end
local i = 1
while i
local randNum = math.random (1, maxRandom)
local flagNew = false
for j = 1 , randCount do
if randomArray[j]==randNum then
flagNew = true
break
end
end
if flagNew==false then
randomArray[i]=randNum
i=i+1
end
end
for k=1, randCount do
print("Values---->".. randomArray[k])
end
end

Baca Selengkapnya ....

Getting the Number of Children in a Group (Size)

Posted by Unknown Kamis, 03 Januari 2013 0 komentar
Sample code to get the size of groups in corona :

for i=1, group.numChildren do
local child = group[i]
local description = (child.isVisible and "visible") or "not visible"
print( "child["..i.."] is " .. description )
end

Baca Selengkapnya ....

Working with images in Corona

Posted by Unknown 0 komentar
Loading an Image :
syntax:
display.newImage( filename [, baseDirectory] [, left, top] )
example:
newImage = display.newImage( "image.png", 10, 20 ) myImage2 = display.newImage( "image.png" )
Image Autoscaling:
The default behavior of display.newImage() is to auto-scale large images.To control manually we can use boolean value.
syntax:
display.newImage( [parentGroup,] filename [, baseDirectory] [, x, y] [,isFullResolution] )
example:
newImage = display.newImage( "image.png", 10, 20, true )
Images with Dynamic Resolution :
syntax:
display.newImageRect( [parentGroup,] filename [, baseDirectory] w,h )
example:
newImage = display.newImageRect( "Image.png", 100, 100 )

Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.