Let's set up some win/lose notifications so that we can display these events that occur in game:
Create a new function called
alertScreen()
and pass two parameters calledtitle
andmessage
. Add in a new display object calledalertbox
and have it transition fromxScale
andyScale
of 0.5 usingeasing.outExpo
:function alertScreen(title, message) alertBox = display.newImage("alertBox.png") alertBox.x = 240; alertBox.y = 160 transition.from(alertBox, {time = 500, xScale = 0.5, yScale = 0.5, transition = easing.outExpo})
Store the
title
parameter in the text object calledconditionDisplay
:conditionDisplay = display.newText(title, 0, 0, "Arial", 38) conditionDisplay:setFillColor( 1, 1, 1 ) conditionDisplay.xScale = 0.5 conditionDisplay.yScale = 0.5 conditionDisplay.anchorX = 0.5 conditionDisplay.x = display.contentCenterX conditionDisplay.y = display.contentCenterY - 15
Store the
message
parameter in the text object calledmessageText...