ok so i was advised to make this topic so that i can solve problems and get my problems solved. so here is the first problem.
i would like to know with the following code how i can make it to where the player can only go one direction at a time and to have to diagonal directions. because its just to glitchey when it comes to collision so here is the code
ok so dir is the variable that controls what frames need to be animated during a certain direction movement so if dir = D_UP then that means the player is moving up and to draw the up frames. btw dir is of type const
If KeyDown(200) Then playery = playery - 5 : dir = D_UP
If KeyDown(208) Then playery = playery + 5 : dir = D_DOWN
If KeyDown(203) Then playerx = playerx - 5 : dir = D_LEFT
If KeyDown(205) Then playerx = playerx + 5 : dir = D_RIGHT
so there it is, if u can help me out then i appreciate it 100%
and if you need help with any code problems i'll do my best to help with yours as well
If keyhit(LEFT) And keyhit(UP) player\direction = 1 ;If player is hitting up and left make the player just go up
So instead of playerx = x + x
I have a direction if it equals one the player is going up 2 down 3 left 4 right so on so fourth.
If you need a better explanation just say so
Edit: The direction sets the player's x and y, and it does the animation...
Last edited by eatcomics on Fri Jan 02, 2009 11:51 pm, edited 1 time in total.
I think I read your post wrong, you want up, down, left, right, and going up and left, or up and right, and you want an animation for that... Just make a new direction like D_UPRIGHT or D_DOWNLEFT so you would have this
If keydown(LEFT) and keydown(UP)
playerx = playerx + 5
playery = playery - 5
playerdirection = D_UP_LEFT ;Then draw the proper animation play
endif
At least I think that should solve your problem.
I'm not exactly sure what you want, if this isn't what you want (and the other post isn't either) then tell me exactly what you want
so you want 4 directions, just make sure if two buttons are pressed at once to just make the player go in one direction I can help further if you pmed me with your code, I think you have it layed out different then me, that is where the problem is:)
That's good to hear...I myself am working on a post zombie apocalyptic text based rpg in c++ and don't know where to go next....
although I doubt the project will ever be done, it gets me away from my blitz game
I dont know blitz, but i guess that it also has an else if statement. Just make it:
if keydown(UP) goUp();
else if keydown(DOWN) goDown();
else if ....
else if ....
then it will stop checking when it finds a key that is down, and therefor only go in one direction per frame. The problem, if you think it is a problem, is that the buttons has some kind of heiracy. if all arrow keys are down, then the charactor will go up, because up is the first that get chekked, and so on.
yea i got it and it works perfectly and has no glitches so i am good. so the next topic of this thread is on how to create GUI's for your programs . so if u know anything about GUI and how to make it work with blitz basic then feel free to post a tutorial or a site,!!!!!!
yep sure does have an else if, does c++, I can't remeber... well you don't have to tell me I can look it up later I guess.
I myself have been looking at gui, but not actually used it so I don't know if I will be any help.... although, I may use it later for my rts.... maybe.... most likely... so many...'s oh well...