本次教程是学习制作 木琴app,实现最简单的功能--弹奏木琴
背景采用本图,主要是为了方便确定八个键的位置
本次用到了 史上最简单的手机app教程 基于Corona SDK(2)中的按钮代码,直接复制代码ui.lua放在与main.lua相同的文件夹中,在main.lua调用ui.lua
local ui = require("ui")
local on1Touched = function(event)
if event.phase=="press" then
audio.play(mysound1) ----播放声音文件“mysound1”
end
end
local sound1Button =ui.newButton{
defaulSrc ="1.png",
defaultX=54, ----初始位置x
defaultY=224, ----初始位置y
overSrc="1P.png"