Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411274 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 04:11:49 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)How do you specify fire point in a sprite sheet
Pages: [1]
Print
Author Topic: How do you specify fire point in a sprite sheet  (Read 742 times)
dodo
Level 0
*



View Profile
« on: November 07, 2017, 09:32:12 AM »

Hi all,

Let's say the following sprite sheet is our character (flakt guy from ra2). As you can see the fire point (muzzle of bazooka) is in different part of the sprite for every direction.

The character will shoot bullet from this coordinate. Do i have to specify fire coordinates for every sprite for every direction, or is there a workaround?

Thanks in advance.

Logged

If we’d asked the customers what they wanted, they would have said “faster horses”

        — Henry Ford
oahda
Level 10
*****



View Profile
« Reply #1 on: November 07, 2017, 11:10:22 AM »

I can't really think of a better way. But if you want to do it more visually maybe you could make a copy of the image and put a pixel of a unique colour not used elsewhere, like magenta, at every point where you want to bullet to come from for each sprite and then write a little script to output the positions of all the magenta pixels for you. That way you can use the script in the future too.
Logged

AlexRamallo
Level 1
*


:0


View Profile WWW
« Reply #2 on: November 07, 2017, 11:23:20 AM »

You don't have to specify it manually. A visual workflow would definitely be optimal if you were going to, but depending on the game and bullet mechanics, you could just get cheap with it and assign an angle to each sprite and spawn all the bullets a set distance from the center. Maybe overlay all the frames ontop of each other, mark the desired bullet spawn points with a single pixel, and then connect all the pixels together to make a polygon. With that, you'll be able to pick the best-fitting dimensions for the circle or ellipse you want to use.
Logged

dodo
Level 0
*



View Profile
« Reply #3 on: November 07, 2017, 12:24:59 PM »

Thanks guys, i was putting every detail in json by hand, it's never occurred to me to do it visually.

@AlexRamallo, i did what you've suggested, i've got an ellipse, i can calculate the distance and other things from there, thanks for the idea.
Logged

If we’d asked the customers what they wanted, they would have said “faster horses”

        — Henry Ford
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic