Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Cut-off Frames in Sprite Animation
Started by danielbeer1376 Jul 02 2018 06:51 AM

1 reply to this topic
sprite animation frames cut-off broken
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

danielbeer1376

[GLOBAL: userInfoPane.html]
danielbeer1376
  • Enthusiast

  • 61 posts
  • Corona SDK

I'm currently working on a project which uses an animated spaceship with flickering lights. I'm setting the animation as follows:

	local shipSheet = graphics.newImageSheet("scene/graphics/ship-front.png", {
		width = 96,
		height = 22,
		numFrames = 2,
		sheetContentWidth = 96,
		sheetContentHeight = 44
		}
	);
	
	shipFront = display.newSprite(playerGroup, shipSheet, {
		name = "flash",
		frames = {1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
		time = 1600,
		loopCount = 0,
		loopDirection = "forward"
		}
	);
	shipFront.x, shipFront.y = shipBack.x, shipBack.y + 18;
	
	shipFront:play();

However, though the animation plays it doesn't seem to be working correctly. I've attached two images below that show how the first frame draws a little bit of the second frame at the bottom and the second frame ends up losing a row of pixels at the top. It's very subtle but it's significant enough that I don't want it to look like that, especially when I end up adding the vector graphics instead of the sketchy raster ones. The spritesheet is 96x44px.

 

Attached File  ship1.PNG   13.83KB   0 downloads

 

Attached File  ship2.PNG   14.51KB   0 downloads

 

Thanks in advance!

 

EDIT: Just to add I've also tried using what's explained in "Complex Options" here: https://docs.coronalabs.com/guide/media/imageSheets/index.html but it hasn't helped



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,119 posts
  • Corona Staff

Can you put your project in a .zip file and share a URL to it where the community can download it and see everything (including images) that you're using?

 

Rob


  • roaminggamer likes this


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: sprite, animation, frames, cut-off, broken