Changing to Horizontal mode

Good day everyone!

I really need your help please guys… :frowning:

Can someone turn this into horizontal mode?.. i just want to test this game and appreciate your help.

The original of this codes are made in vertical mode but i want to make it horizontal but i can’t understand for now to make things right. Only need to see this to “shoot” in a horizontal mode.

Please guys help and i will respect your opinions :)…

The codes are here… if you are interested to help me guys. PM me your emails. I cant attach files for now.

----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- -- Experiments controlling the firing habits of defense elements -- This time defense elements only fire at enemies in their row display.setStatusBar( display.HiddenStatusBar ) local TILE\_ROWS = 9 local TILE\_COLS = 5 local TILE\_SIZE = 48 local TILE\_MARGIN = 1 local BULLET\_SPEED = 1000 / 400 local defense\_array = {} local alien\_array = {} local bullet\_array = {} local game\_group = display.newGroup() local defense\_group = display.newGroup() local alien\_group = display.newGroup() local tile\_group = display.newGroup() game\_group:insert( tile\_group ) game\_group:insert( defense\_group ) game\_group:insert( alien\_group ) local function remove\_bullet( bullet ) local index = table.indexOf( bullet\_array, bullet ) transition.cancel( bullet.transition ) table.remove( bullet\_array, index ) display.remove( bullet ) end local function make\_bullet( x, y ) local bullet = display.newCircle( 0, 0, 5 ) bullet:setFillColor( 0, 0, 0 ) bullet.x = x bullet.y = y table.insert( bullet\_array, bullet ) local bt = y \* BULLET\_SPEED bullet.transition = transition.to( bullet, {y=0, time=bt, onComplete=remove\_bullet} ) end -- This new function will look at the board and find eligible targets local function defense\_defend( defense ) for i = 1, #alien\_array, 1 do -- Loop through alien\_array local alien = alien\_array[i] -- get the alien if alien.col == defense.col then -- check column make\_bullet( defense.x, defense.y ) break end end end local function remove\_defense( defense ) local index = table.indexOf( defense\_array, defense ) table.remove( defense\_array, index ) display.remove( defense ) end local function make\_defense( x, y ) local defense = display.newRect( 0, 0, 32, 32 ) defense:setFillColor( 200, 0, 0 ) defense\_group:insert( defense ) defense.x = x defense.y = y table.insert( defense\_array, defense ) -- Change the timer handler to call defense\_defend( defense ) defense.timer = timer.performWithDelay( 1000, function() defense\_defend( defense ) end, -1 ) return defense end local function touch\_tile( event ) local phase = event.phase if phase == "began" then local tile = event.target local tile\_x = tile.x local tile\_y = tile.y local defense = make\_defense( tile\_x, tile\_y ) -- Get a reference to the new defense defense.col = tile.col -- assign the col to the new defense end end local function make\_grid() for row = 1, TILE\_ROWS, 1 do for col = 1, TILE\_COLS, 1 do local tile = display.newRect( 0, 0, TILE\_SIZE, TILE\_SIZE ) tile.x = ( TILE\_SIZE + TILE\_MARGIN ) \* col tile.y = ( TILE\_SIZE + TILE\_MARGIN ) \* row tile.col = col -- Tiles need to know col tile.has\_defense = false tile:addEventListener( "touch", touch\_tile ) tile\_group:insert( tile ) end end end local function remove\_alien( alien ) local index = table.indexOf( alien\_array, alien ) transition.cancel( alien.transition ) table.remove( alien\_array, index ) display.remove( alien ) end local function make\_alien() local alien = display.newRect( 0, 0, 32, 32 ) alien:setFillColor( 0, 200, 0 ) local col = math.random( 1, TILE\_COLS ) -- Oops! I had previously used row instead of col here! alien.col = col -- Assign this alien his col position alien.x = col \* ( TILE\_SIZE + TILE\_MARGIN ) alien.y = 0 alien.life = 5 local target\_y = ( TILE\_SIZE + TILE\_MARGIN ) \* TILE\_ROWS local t = ( TILE\_ROWS + 1 ) \* 2000 alien.transition = transition.to( alien, {y=target\_y, time=t, onComplete=remove\_alien} ) alien\_group:insert( alien ) table.insert( alien\_array, alien ) end local function hit\_test( x, y, bounds ) if x \> bounds.xMin and x \< bounds.xMax and y \> bounds.yMin and y \< bounds.yMax then return true else return false end end local function on\_enterframe( event ) for b = 1, #bullet\_array, 1 do local bullet = bullet\_array[b] if b \> #bullet\_array then return end for a = 1, #alien\_array, 1 do local alien = alien\_array[a] if hit\_test( bullet.x, bullet.y, alien.contentBounds ) then if alien.life \> 0 then alien.life = alien.life - 1 else remove\_alien( alien ) end remove\_bullet( bullet ) break end end end end Runtime:addEventListener( "enterFrame", on\_enterframe ) make\_grid() local alien\_timer = timer.performWithDelay( 5300, make\_alien, -1 ) local memory\_text = display.newText( "Hello", 5, 5, native.systemFont, 16 ) memory\_text:setTextColor( 255, 0, 0 ) memory\_text.x = display.contentCenterX local monitorMem = function() collectgarbage() local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000 memory\_text.text = "Mem:"..collectgarbage("count") .. " tex:".. textMem end Runtime:addEventListener( "enterFrame", monitorMem )

Hi @expertpurty. Welcome to the forums. You will find more luck with your question if you edit your post and re-post your code using the code entry tool. It’s the blue <> button in the bar with bold, italics, etc. this will preserve your codes formatting and provide syntax highlighting. Rob

Thanks Rob! for guiding me to freely post here! your a Miracle!! :slight_smile:

Hi @expertpurty. Welcome to the forums. You will find more luck with your question if you edit your post and re-post your code using the code entry tool. It’s the blue <> button in the bar with bold, italics, etc. this will preserve your codes formatting and provide syntax highlighting. Rob

Thanks Rob! for guiding me to freely post here! your a Miracle!! :slight_smile: