Con algo de programación podrás crear tus videojuegos para iPhone, iPad, iPod Touch... y más tarde, si quieres, ponerlos en la AppStore (pagando)
¿Es gratis?
El programa tiene su fase gratuita, y otra que hay que pagar.
Para descargar Corona SDK: http://developer.anscamobile.com/downloads/windows
Te registras, y lo descargas. (Hay que registrarse y pagar aparte en los diferentes App Store para publicar en su caso)
Otros enlaces con corona-lua del foro y :Para Crear requerimientos (además de tener un aparato físico que es muy recomendable):
Android: Java JDK (Java Developers Kit), http://www.oracle.com/technetwork/java/ ... index.html
IOS: Mac y Apple iOS SDK - Xcode (solo para publicar), se puede desarrollar en Windows (posteriormente necesitas mac para poder instalar--eg: Mac Mini o Vmware Win o http://www.macincloud.com/)
Tutoríal español corona para windows, una vez instalado corona sdk (Requerimientos bajos: XP,W7, 1GHZ, 38MB, OpenGl 1.3)
http://campamentoweb.blogspot.com/2011/ ... k.html?m=1
También se puede usar el Scite u otro editor, como el que viene con http://www.coronaprojectmanager.com o el Eclipse y su plugin-Corona-lua :
crear un documento de bloc de notas, renombrarlo con "main.lua", y allí colocar la programación para luego probarlo?
Eso es lo que hay que hacer para ejecutar el programa en el simulador!!
Aquí otro Hello World Más complicado que el del ejemplo, cada vez que hago un tap en la pantalla como un click con el dedo cambia el color del hola Mundo, automáticamente:
Ya instale el instalador gratuito CoronaSDK-2011.704 que instala un grupo de programas con las utilidades. Arrancando el Corona simulator puedes modificar el txt del main.lua, y retocar en un editor de txt, cualquier programa de la carpeta samples .lua, y previsualizar los cambios (run) en el simulador. Parece que ya hice mi primer programa compatible con moviles, cambié el texto del "Hello World" por "Hola que tal", y lo arranqué en el simulador. Impresiona que he hecho mi primera aplicación para móviles entendiendo el código fuente, aunque se vea en el simulador y no en mi movil.local textObject = display.newText( "Hola Mundo!", 50, 50, nil, 24 )
textObject:setTextColor( 255, 0, 0 )
--- creo la variable txtObject al mostrar con display el texto , luego con :setTextColor cambio el color
--- esta función es la que se llama del EventListener que es como un hotkeyset() que llama a la función taplistener:
function EscuchadordeTaps( event )
local r = math.random( 0, 255 )
local g = math.random( 0, 255 )
local b = math.random( 0, 255 )
textObject:setTextColor( r, g, b )
print('tap detectado')
end
--- aqui una llamada como el hotkeyset() esperando por "la tecla" tap
Runtime:addEventListener( "tap", EscuchadordeTaps )
Como crear en 10 minutos y tener tu aplicación para Android o Iphone:
Hay varios ficheros en cada proyecto, pero el que nos va interesar es el main.lua donde podemos programar el Script, verás que facil es lo que está en negrita es el código, lo demás son explicaciones que puede que no necesites:
Fuente: http://learningcorona.com/
Corona for Newbies, Part 1 - Introduction
Corona for Newbies, Part 2 - Sounds and Music
Corona for Newbies, Part 3 - Dragging and Practical Usage
Corona for Newbies, Part 4 - Physics
Un poco más avanzado:----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Para esconder la barra de estado
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Colocando la imagen del fondo
--[[
Here, we say that we are adding something to the project and calling it "background".
We are then saying that this is a new image and then stating which image from our project's folder we would like to use.
We don't need to specify coordinates as the background image should always be the same size as
our screen, which is 320 x 480.
--]]
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
Hi! That's me :3
As you can see we are creating the image in the same way we did the background;
We state that we're adding a new image, calling it "peachpic" and that the file name is "peach.png".
Because this is not our background we need to state where the image should be on the page using
our new image's name.
I have centered it for the iPhone using numbers, because I like numbers - but to center an image you
could also use;
peachpic.x = display.contentWidth / 2
peachpic.y = display.contentHeight / 2
Otra función:----------------------------------------------
-- SETTING UP --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
local background = display.newImage ("background.png")
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
The above is what we have already covered.
The below is what we're now learning!
--]]
----------------------------------------------
-- A FUNCTION --
----------------------------------------------
local function killpeach (event)
peachpic:removeSelf()
end
--[[
Here we state that we're creating a new function, (an event), and we are naming that event "killpeach".
One of the most common things to do when creating a game is to remove things, so that is what we're
doing here; in this event peachpic (our image) is going to remove itself.
But wait! How will the function work? When will the image remove itself? We need to define that as well.
--]]
----------------------------------------------
-- THE LISTENER --
----------------------------------------------
peachpic:addEventListener ("touch", killpeach)
--[[ si tocamos con el dedo - touch se ejecuta la función killpeach
Here we tell our image to "listen" for the function being called.
We state that when the image receives a "touch" it should perform the function killpeach.
If you try this now, clicking me will remove the picture.
--]]
Añadiendo movimiento:----------------------------------------------
-- SETTING UP --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
local background = display.newImage ("background.png")
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
The above is what we have already covered.
The below is what we're now learning!
--]]
----------------------------------------------
-- A FUNCTION --
----------------------------------------------
local function killpeach (event)
peachpic:removeSelf()
end
--[[
Here we state that we're creating a new function, (an event), and we are naming that event "killpeach".
One of the most common things to do when creating a game is to remove things, so that is what we're
doing here; in this event peachpic (our image) is going to remove itself.
But wait! How will the function work? When will the image remove itself? We need to define that as well.
--]]
----------------------------------------------
-- THE LISTENER --
----------------------------------------------
peachpic:addEventListener ("touch", killpeach)
--[[
Here we tell our image to "listen" for the function being called.
We state that when the image receives a "touch" it should perform the function killpeach.
If you try this now, clicking me will remove the picture.
--]]
Haciendo play a media - un sonido:----------------------------------------------
-- SETTING UP --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
local background = display.newImage ("background.png")
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
The above is what we have already covered.
The below is what we're now learning!
--]]
----------------------------------------------
-- A FUNCTION --
----------------------------------------------
local function killpeach (event)
peachpic:removeSelf()
end
--[[
Here we state that we're creating a new function, (an event), and we are naming that event "killpeach".
One of the most common things to do when creating a game is to remove things, so that is what we're
doing here; in this event peachpic (our image) is going to remove itself.
But wait! How will the function work? When will the image remove itself? We need to define that as well.
--]]
----------------------------------------------
-- THE LISTENER --
----------------------------------------------
peachpic:addEventListener ("touch", killpeach)
--[[
Here we tell our image to "listen" for the function being called.
We state that when the image receives a "touch" it should perform the function killpeach.
If you try this now, clicking me will remove the picture.
--]]
Un poco más avanzado:----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Here we are hiding the iPhone's status bar; as covered in CFN Part 1
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Here we set our background, also covered in part 1
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
And here I am again!
The code below is new, so now is the time to start paying attention!
--]]
----------------------------------------------
-- A SIMPLE SOUND --
----------------------------------------------
local ouch = media.newEventSound ("ouch.wav")
-- 1
local function playouch (event)
media.playEventSound (ouch)
end
-- 2
peachpic:addEventListener ("touch", playouch)
-- 3
--[[
1. This is us stating that ouch is a sound and that sound is ouch.wav. (This can be found in the folder)
2. It's all well and good to have a sound, but it's useless without a function to make it play. Here
we create a function to play "ouch".
3. We add a listener to my picture telling it that when touched, it should perform the function and
thus play the sound. We could use anything to make it play, collision, the position of my picture, etc.
but for simplicities sake we're using touch today.
--]]
Música de fondo:----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Here we are hiding the iPhone's status bar; as covered in CFN Part 1
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Here we set our background, also covered in part 1
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
And here I am again!
The code below is new, so now is the time to start paying attention!
--]]
----------------------------------------------
-- A SIMPLE SOUND --
----------------------------------------------
local ouch = media.newEventSound ("ouch.wav")
-- 1
local function playouch (event)
media.playEventSound (ouch)
end
-- 2
peachpic:addEventListener ("touch", playouch)
-- 3
--[[
1. This is us stating that ouch is a sound and that sound is ouch.wav. (This can be found in the folder)
2. It's all well and good to have a sound, but it's useless without a function to make it play. Here
we create a function to play "ouch".
3. We add a listener to my picture telling it that when touched, it should perform the function and
thus play the sound. We could use anything to make it play, collision, the position of my picture, etc.
but for simplicities sake we're using touch today.
--]]
Arrastrar una imagen:----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Here we are hiding the iPhone's status bar; as covered in CFN Part 1
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Here we set our background, also covered in part 1
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
And here I am again!
The code below is new, so now is the time to start paying attention!
--]]
----------------------------------------------
-- A SIMPLE SOUND --
----------------------------------------------
local ouch = media.newEventSound ("ouch.wav")
-- 1
local function playouch (event)
media.playEventSound (ouch)
end
-- 2
peachpic:addEventListener ("touch", playouch)
-- 3
--[[
1. This is us stating that ouch is a sound and that sound is ouch.wav. (This can be found in the folder)
2. It's all well and good to have a sound, but it's useless without a function to make it play. Here
we create a function to play "ouch".
3. We add a listener to my picture telling it that when touched, it should perform the function and
thus play the sound. We could use anything to make it play, collision, the position of my picture, etc.
but for simplicities sake we're using touch today.
--]]
Limitar que la imagen no se salga de la pantalla:----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Here we are hiding the iPhone's status bar; as covered in CFN Part 1
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Here we set our background, also covered in part 1
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
You should understand the above code from Corona For Newbies Part 1 and Part 2.
These can be found on http://techority.com
--]]
----------------------------------------------
-- DRAGGING PEACH --
----------------------------------------------
local function dragpeach (event)
peachpic.x = event.x
peachpic.y = event.y
end
peachpic:addEventListener ("touch", dragpeach)
--[[
The above function says that while "touch" is on peachpic, we want to match the event coordinates.
Because this is a touch event, event.x will be wherever the touch is, providing it is on peachpic.
--]]
Ejemplo práctico:----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Here we are hiding the iPhone's status bar; as covered in CFN Part 1
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Here we set our background, also covered in part 1
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
You should understand the above code from Corona For Newbies Part 1 and Part 2.
These can be found on http://techority.com
--]]
----------------------------------------------
-- DRAGGING PEACH --
----------------------------------------------
local function dragpeach (event)
peachpic.x = event.x
peachpic.y = event.y
end
peachpic:addEventListener ("touch", dragpeach)
--[[
This was covered in the previous section. If you don't understand the function please go back
and look over it again!
--]]
----------------------------------------------
-- KEEP IT ON SCREEN --
----------------------------------------------
local function wrapit (event)
if peachpic.x < 30 then
peachpic.x = 30
elseif peachpic.x > 290 then
peachpic.x = 290
elseif peachpic.y < 30 then
peachpic.y = 30
elseif peachpic.y > 450 then
peachpic.y = 450
end
end
Runtime:addEventListener("enterFrame", wrapit)
--[[
The above adds a function tied to a Runtime listener, meaning it's basically constantly triggering.
We are stating that if peachpic moves outside of the coords we've set (around the edges of the screen)
that it must be moved back inside these coordinates.
You will notice I have called the function "wrapit", this is my own habit. We are not wrapping the
screen; wrapping would mean having peachpic pop up at the bottom when it went too high, or from the
left when it went too far right, etc.
I'm a creature of habit, but I encourage you to find appropriate function names for your own projects.
--]]
----------------------------------------------
-- THE STATUS BAR --
----------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
-- Here we are hiding the iPhone's status bar; as covered in CFN Part 1
----------------------------------------------
-- COMMENTING --
----------------------------------------------
local background = display.newImage ("background.png")
-- Here we set our background, also covered in part 1
----------------------------------------------
-- A SIMPLE IMAGE --
----------------------------------------------
local peachpic = display.newImage ("peach.png")
peachpic.x = 160
peachpic.y = 230
--[[
You should understand the above code from Corona For Newbies Part 1 and Part 2.
These can be found on http://techority.com
--]]
----------------------------------------------
-- DRAGGING PEACH --
----------------------------------------------
local function dragpeach (event)
peachpic.x = event.x
peachpic.y = event.y
end
peachpic:addEventListener ("touch", dragpeach)
--[[
This was covered in the previous section. If you don't understand the function please go back
and look over it again!
--]]
----------------------------------------------
-- KEEP IT ON SCREEN --
----------------------------------------------
local function wrapit (event)
if peachpic.x < 30 then
peachpic.x = 30
elseif peachpic.x > 290 then
peachpic.x = 290
elseif peachpic.y < 30 then
peachpic.y = 30
elseif peachpic.y > 450 then
peachpic.y = 450
end
end
Runtime:addEventListener("enterFrame", wrapit)
--[[
The above adds a function tied to a Runtime listener, meaning it's basically constantly triggering.
We are stating that if peachpic moves outside of the coords we've set (around the edges of the screen)
that it must be moved back inside these coordinates.
You will notice I have called the function "wrapit", this is my own habit. We are not wrapping the
screen; wrapping would mean having peachpic pop up at the bottom when it went too high, or from the
left when it went too far right, etc.
I'm a creature of habit, but I encourage you to find appropriate function names for your own projects.
--]]