Skip to main content
gamedev.net
🔒 Locked

Weapon actions

Started by raptorstrike 8 replies 700+ views
Original Post
raptorstrike
raptorstrike
ok im working on a 2d RPG as some of you know and im trying to figure out how i would do attacks with diffrent weapons if the what the weapon looked like could change. It would be nice if i could just set a template way to rotate and move the weapon regardless of the way it looks but i cant figure out a way to do this. Maybe if i were doing OpenGL but i dont think there is a function in SDL that dose that so i was hoping someone here could help me think of a way. Thanks [grin]
____"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
graveyard filla
graveyard filla
what kind of view is the game? maybe you could come up with some sort of "overlay" system where you first draw a bare character, then draw over him any "pieces" to him , such as the weapon hes holding, or armor he is wearing. it would be tricky to set everything up right (sorting, setting the offsets correctly), but in the end would let the player fully customize his character (if you had the art, that is [smile]).
FTA, my 2D futuristic action MMORPG
raptorstrike
raptorstrike
i was planning on doing that but the question now is how i can kind of ATTACH the weapons and armmor onto the player so that they move in sync with him but so that i dont have to have the same animation with ever image and every type of armmor/weapon
____"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Zahlman
Zahlman
Associate weapons and armor with the player struct.

Give the weapons and armor information about where they are drawn relative to the player.

When it comes time to draw the player, have the player draw itself, then tell the weapons and armor where it is, so that they can draw themselves at the appropriate world coordinates.
raptorstrike
raptorstrike
that works great if the weapon is static and is probibly the method i will have to use if this thread dosnt turn up much but what if i want to rotate it? I would have to have animation of all the diffrent rotations unless i used hardware sprite rotation and i really dont want to require any kind of graphics hardwear for a 2d RPG
____"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
graveyard filla
graveyard filla
if you want to rotate SDL Surface's, google for SDL_gfx
FTA, my 2D futuristic action MMORPG
raptorstrike
raptorstrike
thanks ill use that one thing though

it gives me a

[Linker error] undefined reference to `_imp__rotozoomSurface'

NOTE: it adds the _imp_ by itself thats not how im calling it
but i am including the file and everything but it still gives me that why?

thanks again
____"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Drew_Benton
Drew_Benton
Did you link in the necessary library files?
leiavoia
leiavoia
when you get it working, what you could do is take a "weapon" graphic and automatically rotate it to several different angles for a kind of "animation". Then save each frame as a seperate SDL surface (i assume you are using SDL). That way, you don't have to create multiple static frames of animation by hand.
raptorstrike
raptorstrike

when you get it working, what you could do is take a "weapon" graphic and automatically rotate it to several different angles for a kind of "animation". Then save each frame as a seperate SDL surface (i assume you are using SDL). That way, you don't have to create multiple static frames of animation by hand.
[/Quote]

ill do it that way or ill rotate it on the fly thanks for the idea


did you include the libs
[/Quote]

the thing i download didnt come with libs were can i find em?
____"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.