Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

sprites
Started by zettelrhean Oct 04 2018 09:35 AM

5 replies to this topic
lua corona
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

zettelrhean

[GLOBAL: userInfoPane.html]
zettelrhean
  • Observer

  • 25 posts
  • Corona SDK

function Start (event)
	options = 
	{
		width = 95,
		height = 50,
		numFrames = 2
	}
		floorLvl = 1
		btnStart.isVisible = false
		textStart.isVisible = false
		background.isVisible = false
		textTitle.isVisible = false
		textTitle2.isVisible = false
		room = display.newImage("room.png")
		room.x = 240
		room.y = 160
		room.xScale = 1.55
		room.yScale = 1.55
		sprPlayer = display.newImage("Player.png")
		sprPlayer.x = G
		sprPlayer.y = X
		sprPlayer.xScale = 0.5
		sprPlayer.yScale = 0.5
		mveSqrTL = graphics.newSprite("movementSQR.png", options)
		mveSqrTL.xScale = 0.65
		mveSqrTL.yScale = 0.65
		mveSqrL = graphics.newSprite("movementSQR.png", options)
		mveSqrL.xScale = 0.65
		mveSqrL.yScale = 0.65
		mveSqrBL = graphics.newSprite("movementSQR.png", options)
		mveSqrBL.xScale = 0.65
		mveSqrBL.yScale = 0.65
		mveSqrB = graphics.newSprite("movementSQR.png", options)
		mveSqrB.xScale = 0.65
		mveSqrB.yScale = 0.65
		mveSqrT = graphics.newSprite("movementSQR.png", options)
		mveSqrT.xScale = 0.65
		mveSqrT.yScale = 0.65
		mveSqrTR = graphics.newSprite("movementSQR.png", options)
		mveSqrTR.xScale = 0.65
		mveSqrTR.yScale = 0.65
		mveSqrR = graphics.newSprite("movementSQR.png", options)
		mveSqrR.xScale = 0.65
		mveSqrR.yScale = 0.65
		mveSqrBR = graphics.newSprite("movementSQR.png", options)
		mveSqrBR.xScale = 0.65
		mveSqrBR.yScale = 0.65

im trying to make a sprite that switches to its next frame once tapped but i have no clue how it works, i have the image and everything but i dont know how the code goes



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,363 posts
  • Corona SDK

There are many ways to handle this, here is one example:

 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/10/touchPlaySprite.zip



[TOPIC: post.html]
#3

zettelrhean

[GLOBAL: userInfoPane.html]
zettelrhean
  • Observer

  • 25 posts
  • Corona SDK

this sorta helps but how do i call to a different lua file?



[TOPIC: post.html]
#4

Michael Flad

[GLOBAL: userInfoPane.html]
Michael Flad
  • Contributor

  • 194 posts
  • Corona SDK

https://www.lua.org/pil/contents.html

https://www.lua.org/manual/5.1/



[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,363 posts
  • Corona SDK

There is no single one-size fits all answer that will help you out here.   So, it is very hard to give you an answer.

 

There are so many ways to solve this I'd be here all day writing them out and giving you working code.  Corona is very flexible in terms of solutions to tasks.

 

I'd take a time out on this and work my way through the Guides and Tutorials (like we all did).

 

Then peruse the API docs.  Finally, you can take apart the many samples that come with Corona when you install it.

 

The docs on this site are incredible and thorough, but you still have to invest time to get a foundational understanding of how things work.

 

As well, be sure you're up to speed on Lua (see Michael's links above)

 

PS - There are good books out there too if you want additional sources to take you through learning Corona fundamentals.

https://burtonsmediagroup.com/books/coronasdk/



[TOPIC: post.html]
#6

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,363 posts
  • Corona SDK

One last note.  While it is nice that you posted code, it is hard to help based on that code.

 

Another way to get specific help here is to make a tiny (just config.lua and main.lua as well as any required images, etc.) test-bench project showing what you have so we can download and run it.

 

Then you can ask for help fixing a specific issue with that test bench.

 

Just make the example as tiny as humanly possible but so that it still runs and is legible.

 

You can click 'more reply options' below to attach a zipped copy of this TINY working test bench.




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: lua, corona