Ive been having a look at how to control a character using simple w,a,s,d keys and animating the sprite as he moves as someone has created an awesome isometric sprite sheet that i would like to use for now to demonstrate how this is done. Now the movement is fine, though in this version i havent added north east, north west, south east etc yet the principle will work (i just could do with tweeking the character movement and animation speed to match how hes walking)
Now i have a problem here. As the animation plays through the full range of frames its been set at, a change in direction makes it play through all the frames until it gets to where its supposed to be, but there isnt anythnig like a stop animation when your not holding the key down (it does stop but wants to resume when you change direction till it is finished). I need something to make this transition smooth so when you stop holding down the key, perhaps it resets back to the first frame and gets it ready for a direction change without wanting to play through.
Because there are apparently hundreds of ways to move a sprite no one person has written a tutorial that can be gone through and understood easily. I can understand this in a way but with no former background knowledge of program i have to ask the question, how the hell do people just do it. Do you wake up one day and say, there thats how its done. How does one learn some of the different method in order to choose which one may be best for himself. What are the different methods, whats the pro's and con's of each? Or where does one buy the implant that makes people just wake up with the knowledge of how to do these things because its hard enough to find info with the internet, i know most folk here probably knew how to do this pre internet.
Please help, i am at a very frustrated point in learning to program at the moment and i need all the help i can get so i can stand on my own two feet eventually.
Code is here:
Sync On
Sync Rate 60
Set Display Mode 1024, 768, 16
Set Window Position 350, 150
set image colorkey 255, 0, 255
#Constant Ogre 100
remstart #Constant OgreE 101
#Constant OgreN 102
#Constant OgreNE 103
#Constant OgreNW 104
#Constant OgreS 105
#Constant OgreSE 106
#Constant OgreSW 107
#Constant OgreW 108 remend
Type Character
x
y
EndType
Char As Character
`set a rough position somewhere
char.x = 200
char.y = 300
Create Animated Sprite Ogre, "OgreWalk.bmp", 8, 8, 1
Sprite Ogre, 200, 300, 1
Do
HandlePlayer()
Loop
Function HandlePlayer()
If Keystate(17) = 1 ` W
Play Sprite Ogre, 9, 16, 50
Dec char.y
EndIf
If Keystate(32) = 1 ` D
Play Sprite Ogre, 1, 8, 50
Inc char.x
Endif
If Keystate(31) = 1 ` S
Play Sprite Ogre, 33, 40, 50
Inc char.y
Endif
If Keystate(30) = 1 ` A
Play Sprite Ogre, 57, 64, 50
Dec char.x
Endif
Sprite Ogre, char.x, char.y, 1
Sync
Endfunction
I also have a second problem i would like to get sorted. The bmp has a pink alpha channel so i can get some transparancy, however i always get a pink line around my sprites as the program sort of gradients the pixels where they meet creating an almost pink but not quite 255, 0, 255 meaning they will show up. Anyone have any tips for avoiding this? I would absolutely love to use png's as there isnt a transparency problem, what you see is what you get, only problem is i intend to use the "ogre" in collision detection and i want pixel perfect collision from extends which only works with bmps. Bit stuck here.