catacomber wrote:Are you going to have a sprite for the cars with the door open when the player gets in and out?
catacomber wrote:That makes a lot of sense to me and I think it would be very helpful if you would make a demo.
Spidy wrote:4erv' wrote:Here's my taxi...
Nice Taxi
feral wrote:catacomber wrote:That makes a lot of sense to me and I think it would be very helpful if you would make a demo.
ggrrr... always someone who takes up the offer of a demo...![]()
anyhow attached is a "very" rough demo of what I meant about seperate door sprites..
it is very rough because i did not do any cleaning up of stray pixels, and only roughly cut and paste the rotated doors, so the door sort of seems a bit jumpy, but believe me, if time was spent on lining it all up..the the door would fit OK..( it's only a demo![]()
anyhow, the idea is, draw your car and rotate as many times as needed to make a full rotation ( in this case it would be 36 turns as i turned by 10 degrees each time)
then do the same with a door, ( only 36 turns) ( .....and then the opposite side door)
then match up the same animpos for the door as with the car ( ie: if car.animpos=15 then door.animpos=15) etc
but when the door opens simply leave the car at animpos 15 and cycle through the next 4 or five doors to open the door,.. then cycle back to close.. I hope that makes sense as my code is probably not the best way to do it.. but if you watch the demo you should figure it out..
the only other trick is to make sure all your "door" animations have the hinge in the exact center of the sprite so that the sprites x,y, always centers around the hinge....mine is only roughly lined up which is why it jumps a bit..
then to position the hinge - use that groovy circling code to move the hinge in a circle around the centerpoint of the car... so that depending on what angle the car is pointing at the hinge is rotated around to the correct distance and angle from the center of the car.
this gives you any combination of open and shut doors at any angle, with only 3 sprites.
hope that helps![]()
feral
PS: I only animated the door actually opening ( it slams shut.. LOL) but it is just as easy to animate shutting the door...
if the animation doesn't show well.. try setting the games framerate lower..
OH.... keys
left/right cursor to turn ( only turns 5 steps as too lazy to do a full rotation)
space to open shut door.
Users browsing this forum: No registered users and 1 guest