Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

touch error
Started by ahmedmsomji Sep 04 2018 03:59 PM

5 replies to this topic
unexpected symbol

Best Answer nick_sherman , 04 September 2018 - 10:55 PM

And the way you are using display.newImage and scaling by 5x is a tell-tale sign you haven't worked through the basics.

No-one uses newImage to actually display images any more. It's kept around as a quick way of discovering the dimensions of an unknown image, such as one downloaded on the fly.

display.newImageRect is the correct tool for the job.

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ahmedmsomji

[GLOBAL: userInfoPane.html]
ahmedmsomji
  • Observer

  • 12 posts
  • Corona SDK

hey i want to make my button if pressed go to next scene but this error poped up any body know how to fix this 

local options = {
    effect = "fade",
    time = 800,
}

local button = display.newImage ("play_button.png")

button.x = 160
button.y = 330

button:scale( 5.0, 5.0)

local function nextscene (event)

local  touchedObject = event.target

if event.phase then = "began" then
touchedObject.gotoScene( "results", options )

end

end

button:addEventListener("touch", nextscene)

Unexpected symbol near '='

 

File: main.lua

Line: 30



[TOPIC: post.html]
#2

horacebury

[GLOBAL: userInfoPane.html]
horacebury
  • Corona Geek

  • 3,069 posts
  • Corona SDK

[TOPIC: post.html]
#3

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,820 posts
  • Corona SDK

Once you fix that line you're going to run into problems with the next one.

Please learn to walk before you run. I know it's tempting to make a game straight away, but you really need to read the getting started tutorials, play around with and UNDERSTAND the example code that comes with Corona first.

You're doing the equivalent of learning carpentry by throwing a heap of wood and glue at a wall and hoping it becomes a shelf.

[TOPIC: post.html]
#4

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,820 posts
  • Corona SDK

  Best Answer

And the way you are using display.newImage and scaling by 5x is a tell-tale sign you haven't worked through the basics.

No-one uses newImage to actually display images any more. It's kept around as a quick way of discovering the dimensions of an unknown image, such as one downloaded on the fly.

display.newImageRect is the correct tool for the job.

[TOPIC: post.html]
#5

sirmania

[GLOBAL: userInfoPane.html]
sirmania
  • Contributor

  • 154 posts
  • Corona SDK

if event.phase == "began" then



[TOPIC: post.html]
#6

davida6

[GLOBAL: userInfoPane.html]
davida6
  • Contributor

  • 129 posts
  • Corona SDK

I suggest that you get a good book on Lua and work with the language basics before jumping into Corona. I appears from your mistakes that (to use an analogy) you are trying to install a roof, without first building a footer and walls.

I use Corona to build business apps and it is extremely powerful. It also assumes that you know what you are doing “under the covers”, and therefore won’t always tell you when you make logic and non-lua coding errors.


[topic_controls]
[/topic_controls]