Whats wrong?

[lua]–load sound
local select_sound = audio.loadSound( “select.wav” )
local main_music = audio.loadStream( “music.wav” )
–play music
audio.play( main_music )
–set values
money = 1000;
men = 0;
food = 0;
buildings = 0;
strength = 50;
–display background
local logo = display.newImage( “images.jpg” )
–scale and place logo
logo:scale( 2, 4 )
logo.x = 240
logo.y = 400
–display button1
local start = display.newImage( “start.bmp” )
start.x = 225
start.y = 800
start:scale( 3.5, 1.9 )
–create function for tap
function tap( event )
audio.play( select_sound )
–remove background items
start:removeSelf()
logo:removeSelf()
–add background items
local ground = display.newImage( “background.png” )
–customize ground
ground.y = 400
ground:scale( 1.1, 1.5 )
–add swordmen button
local sword_man = display.newImageRect( “swordmen.png”, 60, 60 )
sword_man.x = 30; sword_man.y = 120

–add house button
local house_btn = display.newImageRect( “house1.png”, 60, 60 )
–customize house_btn
house_btn.x = 30; house_btn.y = 60
local textObj = display.newText( money, 5,5, nil, 14);
textObj:setReferencePoint(display.CenterLeftReferencePoint);
textObj.x = 5; textobj = 100;
textObj:scale( 1.3, 1.3 )
–add function for sword_man
local function sword( e )
–decrease money
–if you have enough money
if( money > 2 ) then
audio.play( select_sound )
men = men + 1
money = money - 3
textObj.text = money;
print( swordmen )
swordmen = men + 1
end
end
–add listener for sword button
sword_man:addEventListener( “tap”, sword )
–add function
function house( e )
local house = display.newImage( “realhouse1.png” )
house.x = 300; house.y = 100;
end
–add listener
house_btn:addEventListener( “tap”, house )
–make players be able to customize house
function ctap( e )
local c = display.newImage( “customize1.png” )
audio.play( select_sound )
c.x = 450 ; c.y = 830 ;
c:scale( 1.5, 1.5 )
–add delete button
local x = display.newImage( “x.png” )
x:scale( 1.3, 1.3 )
x.x = 380 ; x.y = 830 ;
end
–add function xtap
function xtap( e )
house:removeSelf()
money = money + 100
textObj.text = money;
x:removeSelf()
c:removeSelf()
–add listener for x
x:addEventListener( “tap”, xtap )
end
–add function ctap1
local function ctap1( e )
c:removeSelf()
x:removeSelf()
audio.play( select_sound )
–add images
local red = display.newImage( “red.png” )
–place red
red.x = house.x - 70; red.y = house.y;
local red1 = display.newImage( “red1.png” )
–place red1
red1.x = house.x + 70; red1.y = house.y;
–add function
local function change( e )
audio.play( select_sound )
local red_house = display.newImage( “realhouse2.png” )
red_house.x = house.x; red_house.y = house.y
red_house:scale( 1.3, 1.3 )
house:removeSelf()
red:removeSelf()
red1:removeSelf()
–add function
local function change1( e )
audio.play( select_sound )
local brown_house = display.newImage( “realhouse.png” )
brown_house.x = house.x; brown_house.y = house.y
brown_house:scale( 1.3, 1.3 )
house:removeSelf()
red:removeSelf()
red1:removeSelf()
–add listener for red_house
brown_house:addEventListener( “tap”, redtap2 )
end
–add listener for red and red1
red:addEventListener( “tap”, change )
red1:addEventListener( “tap”, change1 )
end
–add listener for c
c:addEventListener( “tap”, ctap1 )
–add tap listener for house
house:addEventListener( “tap”, ctap )
end

– A basic function for dragging physics objects
local function startDrag( event )
local t = event.target

local phase = event.phase
if “began” == phase then
display.getCurrentStage():setFocus( t )
t.isFocus = true

– Store initial position
t.x0 = event.x - t.x
t.y0 = event.y - t.y

– Make body type temporarily “kinematic” (to avoid gravitional forces)
event.target.bodyType = “kinematic”

– Stop current motion, if any
event.target.angularVelocity = 0

elseif t.isFocus then
if “moved” == phase then
t.x = event.x - t.x0
t.y = event.y - t.y0

elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( nil )
t.isFocus = false

– Switch body type back to “dynamic”, unless we’ve marked this sprite as a platform
if ( not event.target.isPlatform ) then
event.target.bodyType = “dynamic”
end

end
end

– Stop further propagation of touch event!
return true
end
house:addEventListener( “touch”, startDrag )
end
–add event listener for start button
start:addEventListener( “tap”, tap )[/lua] [import]uid: 15931 topic_id: 8791 reply_id: 308791[/import]

whats wrong? [import]uid: 15931 topic_id: 8791 reply_id: 32026[/import]

why Can’t I drag? [import]uid: 15931 topic_id: 8791 reply_id: 32027[/import]

don’t nest tap touch events

just call touch and on touch.began setup your stuff

c. [import]uid: 24 topic_id: 8791 reply_id: 32034[/import]

What do you mean by nest tap? I’m new, ( only been using it for 12 days ) [import]uid: 15931 topic_id: 8791 reply_id: 32084[/import]