4 Replies - 870 Views - Last Post: 29 December 2011 - 07:48 AM

#1 jp612  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 16-August 11

2D Sprite that does multiple things at once

Posted 29 December 2011 - 03:06 AM

Hi,

I'm learning to make sprite sheets for Xna. However I would like to make a sprite that does several animations at once but that do not always happen at the same time. For example I have quickly made a simple warship sprite in illustrator (attached). What i want to do is create a animation for when it first accelerated for a few seconds where it would quickly rotate upwards and I would draw in a splash animation. But i would also have to be able to rotate the gun turrets almost 180 degrees depending on where the player places the mouse on the screen. I would have to create a huge sprite sheet for every little rotation so it looks smooth. Is this the best way to do this??

Also what if I wanted to accelerate and also rotate the turret. I would have to draw the ship in each stage of the acceleration + every turret possibility so i could achieve this at any stage of the acceleration. I would have to create heaps of different sprite sheets to get all these combos and that seems very complicated. Is there a simpler way to do this??

Also traversing through the sheet to rotate the gun wherever the mouse is would be very hard since its not just one animation going in one direction, the sprite sheet would have to be cycled through forwards and backwards etc. This all seems very complicated again.

I hope this makes sense. Its pretty hard to explain :dontgetit:

BTW I'm pretty new to animation concepts so Im not aware of many techniques to do this type of stuff. Whilst Googling I always found stuff about sprite sheets...

Attached image(s)

  • Attached Image

This post has been edited by jp612: 29 December 2011 - 03:10 AM


Is This A Good Question/Topic? 0
  • +

Replies To: 2D Sprite that does multiple things at once

#2 ShadowsEdge19  Icon User is offline

  • D.I.C Addict

Reputation: 142
  • View blog
  • Posts: 664
  • Joined: 16-January 10

Re: 2D Sprite that does multiple things at once

Posted 29 December 2011 - 03:20 AM

You can rotate and flip an entire sprite already using XNA's in built drawing tools, for the gun turrets though you would either need to have them in a separate sprite sheet, or a single turret cannon that is rotated any way you want but mapped on top of the empty gun placement section of the main sprite.

Or if you want to do multiple versions of the ship but with different combinations of gun turret angles from both cannons, it's up to you, but I would go with keeping the turret cannon separate like I mentioned before and just mapping the cannon to the gun placement oval, though this means when the main sprite rotates you want the cannon to rotate firstly to match the angle of the whole ship and then to the correct angle it is supposed to be aimed at.
Was This Post Helpful? 0
  • +
  • -

#3 jp612  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 51
  • Joined: 16-August 11

Re: 2D Sprite that does multiple things at once

Posted 29 December 2011 - 03:32 AM

Ahh i see so I could just create my base ship drawing in illustrator and then just draw in the cannon using XNAs drawing abilitys (since its nothing but a line) and then rotate it using XNA. I guess i could also do the acceleration with XNA rotating tools.

Thanks, Ill have a read of the Xna rotating tools and try getting the basic sprite in my program.

Where I'm confused is why even create sprites in illustrator? We done a little game programming in my java class in uni ages back and we drew and manipulated everything with the drawing tools java provided I can see that its much easier to draw a complex image in illustrator than trying to with the tools and recompiling everytime to check if its really turned out the way i pictured it. But is there any other reason sprites are created in painting programs?
Was This Post Helpful? 0
  • +
  • -

#4 ShadowsEdge19  Icon User is offline

  • D.I.C Addict

Reputation: 142
  • View blog
  • Posts: 664
  • Joined: 16-January 10

Re: 2D Sprite that does multiple things at once

Posted 29 December 2011 - 04:56 AM

Mostly so that you can get the transparency background effect for the part of the sprite that does not contain your desired shape.
Was This Post Helpful? 0
  • +
  • -

#5 bonyjoe  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 175
  • View blog
  • Posts: 548
  • Joined: 08-September 10

Re: 2D Sprite that does multiple things at once

Posted 29 December 2011 - 07:48 AM

Loading an image is a lot less code than plotting every point in a path to make up the image, even if XNA could use WPF style short hand path drawing ("M 0 1 L 0 5 L 5 5 Z" to draw a custom triangle)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1