Hello,
I am new to both Love and programming in general, and I am trying to learn the basics of game programming. Today's project is sprites. How does one make a sprite do what it is supposed to in Love? I know there is a thing called a "spritemap" (I have one for good ol' Crono) and I know there is a Love object called a SpriteBatch. I am also vaguely aware that there are external programs that somehow manipulate Sprite Maps. How can I combine these things is such a way that I can make Crono walk in place, etc? My plan is just to make a program with dude at the center of the screen, doing what I tell him in place. Any and all help is appreciated.
How do I use a Sprite Map in Love?
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How do I use a Sprite Map in Love?
You probably want Quads, not SpriteBatches. Quads are like viewports on an image, so useful for animations and sprite maps.
Help us help you: attach a .love.
-
- Prole
- Posts: 10
- Joined: Tue Oct 11, 2011 6:37 pm
Re: How do I use a Sprite Map in Love?
Excellent! Any pointers on using those?
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: How do I use a Sprite Map in Love?
I'll leave that one to someone else with more experience in this area.
Help us help you: attach a .love.
Re: How do I use a Sprite Map in Love?
The wiki explains it fairly well, just make sure you are using love.graphics.newQuad and not love.graphics.quad. Then use love.graphics.drawq to draw the quad.enderspike wrote:Excellent! Any pointers on using those?
-
- Prole
- Posts: 10
- Joined: Tue Oct 11, 2011 6:37 pm
Re: How do I use a Sprite Map in Love?
Bad ass. Progress is being made! Now, how do I know which co-ordinate is what in the image? Like, how do I figure out what numbers to put in to get the part of the map I want?
-
- Prole
- Posts: 10
- Joined: Tue Oct 11, 2011 6:37 pm
Re: How do I use a Sprite Map in Love?
Sub-question: do I have to cut out every single image I want to use as a quad?
Re: How do I use a Sprite Map in Love?
What I did was to modify the function so that coordinates are relative, so that 0 is left, 1.0 is right, etc, regardless of the image size. The only problem with this is you'd need to know which image the quad is being applied to.enderspike wrote:Bad ass. Progress is being made! Now, how do I know which co-ordinate is what in the image? Like, how do I figure out what numbers to put in to get the part of the map I want?
-
- Prole
- Posts: 10
- Joined: Tue Oct 11, 2011 6:37 pm
Re: How do I use a Sprite Map in Love?
How do I do that?
This is the image: (couldn't upload it): http://www.google.com/imgres?um=1&hl=en ... 29,r:1,s:0
This is the image: (couldn't upload it): http://www.google.com/imgres?um=1&hl=en ... 29,r:1,s:0
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: How do I use a Sprite Map in Love?
Well... To be honest, that sprite sheet would be a pain in the butt to work with, since the sprites aren't evenly sized or spaced...
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Who is online
Users browsing this forum: No registered users and 0 guests