Im using xlib for the tilemapping and the sprite for the character. I'm having a problem though that i cant seem to fix. Evertime I have my character take a step, all the drawings of his previous location stay on the screen. I was wondering if you knew a way that i can remove those "endtrais" and still have the program run fast?
A faster and more memory efficient way would be to AND the sprite back onto itself before moving it. Be sure to not update the graph buffer until you write the sprite back onto the screen, or else you are likely going to get a flickery look.
I'm not exactly sure what you mean. Do you mean this?
*code for movement*
Real(1,A,B,2,16,5,0,0,0,0,1 //After button is pressed draw the sprite in new location
Real(0,1 //then clear the screen
is that right?
Actually, since you are doing the tilemap every frame, all you need to do is put your code in a loop, and the tilemap will overwrite the previous image.
While(1) Real(2,0,0,0,12,8,0,12,0,8,1,0,8,1 //Tilemap *code for movement* Real(1,A,B,2,16,5,0,0,0,0,1 //After button is pressed draw the sprite in new location End
Oh wow, thats simple lol. It seems like you always answer my xLIB questions. Are you a big fan of xLib?
I'd suggest going with graphmastur timemapping takes time recalling pics is much faster.
i suggested it because he had the tile mapping in his loop, and i assumed it was for a reason. perhaps for a scrolling engine. If you don't need to do the tile mapping continuously, then its better to erase your sprite rather than store a picture and recall it.
I/m not the biggest fan of xLib, but i have used it for several games. (Although it really didn't pan out and they were never released)
I am!!! I wish they made an asm file for those who want to compile their programs into apps. Using Basic Builder, of course… (big fan… Big fan…)
off topic much?
I have onemore quuestion, then ill be able to finish my game. Using tilemapping, how would i do collision detection or what ever its called. Ive tried a few things but they dont work very well.
well, I would have a list showing the tiles you can't step on, but also have it so that if it is one of so many coordinates, than it checks a program that updates the matrix. Think the pokemon games where you would walk through one of the doors and end up in the house. Or, when you go through one of the gates, and it changes.
Something else you could use is that the matrix entries for real(2 (both xLIB and Celtic III's) can have decimals. The tile that's displayed is the integer part, so the fractional part can be used for whatever (e.g. if the entry is 1.03, tile #1 would be displayed). You could use this to differentiate between walkable/non-walkable/special/etc. (e.g. fPart == .1 could mean walkable, .2 would mean not walkable). Then all you have to do is
:If .1=fPart([A](A,B :Then:(doSomeStuff):End :If .2=fPart([A](A,B :Then:(doSomeOtherStuff):End
I never knew you could do that. That way, you could use different decimal numbers for the different directions. For example, only going up stairs instead of jumping over the side.
Yeah it's rather useful I like to use no decimal place for walkable tiles so I can use not( also if your gonna use celtic III make sure you have latest version old one had bugs with that.
I forgot that. You need at least Celtic3.09q. Previous versions mistakenly stripped the decimal point.