Syntax:
math.sqrt (x)
Example:
print (math.sqrt (144)) —> 12
Syntax:
math.sqrt (x)
Example:
print (math.sqrt (144)) —> 12
Syntax:
math.tanh (x)
Example:
print (math.tanh (math.log (2))) —> 0.6
Put this line in your code,
freq = recording:getTunerFrequency()
[self runAction:[CCFollow actionWithTarget:(u r hero) worldBoundary:CGRectMake(0,0,480,1050)]];
value = event.deltaTime
Provides the amount of time since the last accelerometer measurement.
local result = event.isReachable --Returns true if the specified host is reachable. local result = event.isReachableViaWiFi --Returns true if the requested host is reachable via WiFi. local result = event.isReachableViaCellular --Returns true if the host is reachable through the cellular network.
In most Corona codes we see functions being defined in this format:
hello(“there”)
local function hello (a)
print("hello" .. a)
end
The above code would actually give you an error, as the function ‘hello’ isn’t defined until after it is called. You could re-arrange the code so that the call to ‘hello’ was after the function definition, but this isn’t always convenient. It can get a little complicated trying to find an order that works when you have functions calling other functions which in turn call other functions.
Instead it’s better to get into the habit of defining functions like this:
– My Functions
local hello
– Main code
hello(“there”)
hello = function (a)
print(“hello” .. a)
end
Define variables for all the functions you will use at the top of your main.lua, and then don’t worry about the order you define them. You can then group functions together in a more logical way – one that fits with sections of your game. e.g.. Title functions, In Game functions, End Level functions etc.
It is possible to show and hide a floating panel in Sencha Touch.
The method used to show the floating panel is ‘show()’ and the one used for hiding is ‘hide()’. It can be used as follows:
Consider a panel named ‘panelObject’. Now you can show and hide the panel as follows:
panelObject.show(); // For showing the panel.
panelObject.hide(); // For hiding the panel.
It is possible to create a floating panel in Sencha Touch by setting the property ‘floating’ of the panel as true. The sample code is as follows:
floating:’true’ // Adding this line in the panel property will make the panel float.