Wednesday, 15 January 2014

lua - Why does my while code cause my simulator to crash? -


Whenever I add the time code to my game, the simulator stops responding. I know this time that causes this problem, because if I remove time code, then works like a game is wrong with my time code, and how do I fix it? Let me know that you need more information to solve the problem. Here is the code:

  Function view: createScene (event) local group = self.view local tap = display. NewText ("Tap:", 0, 0, "Helvetica", 36) Tap.x = 100 tap.y = ScreenTop + 20 Group: Insert (Null) Local Image Files = {"redbox.png", "bluebox. Local image = fileFiles [math.random (2)] local random image = display .newImage (imageFile, centerX, screen + 20) local button 1 = display.newImage ("redbox.png") button 1.x = Centerx button 1.y = centerY group: insert (button 1) local button 2 = display. NewImage ("bluebox .png") button2.x = centerX button 2.y = centerY - 100 group: insert (button 2) local function endgame (event) if imageFile == "redbox.png" then button 1.x = math .random (55, 300) button1 .y = math.random (55, 300) button2.x = math.random (55, 300) button2.y = math.random (55, 300) local imageFile = imageFiles [math. Random (2)] Local Random Image = Display.newImage (imageFile, centerX, ScreenTop + 20) while imageFile == "redbox.png" should do this if image file ~ = "redbox.png" then storyboa Rd.gotoScene ("restartEasy End) endgame2 (event) end end end event if imageFile == "bluebox.png" button 1.x = math.random (55, 300) button1.y = math.random (55, 300) button2.x= Math.random (55, 300) button2.y = math.random (55, 300) local imageFile = imageFiles [math.random (2)] local random image = display.newImage (imageFile, centerX, screen + 20) ImageFile == "bluebox.png" if imageFile ~ = "bluebox.png" end the end end end of storyboard.gotoScene ("restartEasy") button 1: addEventListener ("Tap", EndGame) Button 2: addEventListener ("Let me know Why are not you and when using? Unnecessarily statement, try that it should work.  
  Local function and game (event) if imageFile == "redbox.png" then the button 1.x = math.random (55, 300) button 1.y = math.random (55, 300) Button2.x = math.random (55, 300) button2.y = math.random (55, 300) local imageFile = imageFiles [math.random (2)] local random image = display.newImage (imageFile, centerX, ScreenTop + 20) and storyboard.gotoScene ("restartEasy") End End  

No comments:

Post a Comment