Missing frame when you change direction

Blitz3D Forums/Blitz3D Beginners Area/Missing frame when you change direction

fox95871(Posted 2009) [#1]
Hi, I'm trying to get sharp directional changes like in some old games, where you press left and the character faces left, you press right and they're instantly facing right, with no frame in between. The problem I was having initially was that I was getting a stray frame in between. For one frame the character wasn't facing one of the eight set directions, but instead some random midpoint direction. So I've since changed to a system where EntityAlpha swaps between one of eight meshes that are always present, each already facing one of the set directions. It's helped to get rid of the midpoints, but now in their place the character is invisible for one frame. Please help if you can.




Warner(Posted 2009) [#2]
It looks like it is the tweening that causes this.
Instead of using EntityAlpha use ShowEntity/HideEntity. That is not affected by the tweaning.
Another thing: I noticed that in your code, you are using CopyEntity(entity, entity) That works once, but the second time you use that, the previously added entity seems to get copied along with it. Because the original mesh has Alpha=0, the copies aren't visible, but if you change that, you'll see a strange looking big mesh. To see it, change:
EntityAlpha character,0
to
EntityAlpha character,1
after "FreeEntity arrow".
In this version, I replaced EntityAlpha by ShowEntity:



Josaih6/10(Posted 2009) [#3]
Why not use "RotateEntity"?


Warner(Posted 2009) [#4]
I guessed it was because they need to be 8 differently shaped meshes? Like when they are optimized to be shown only from one side or something.


fox95871(Posted 2009) [#5]
Because it was causing a problem where you'd sometimes see a non multiple of 45 type angle. In other words, you'd see a frame that was halfway between one of the eight set directions.

I'll check out your suggestion in the next few days Warner, thanks.


Zethrax(Posted 2009) [#6]
If you do your turn immediately before the CaptureWorld command, you should be able to eliminate the tweened frames. Doing it this way may possibly cause additional side effects, though. Some experimentation may be required to get it right.


fox95871(Posted 2009) [#7]
Cool, I'll experiment then. To be honest the only things I know about the render tween is what it's for and how to use it. How it works or any of that I have no idea about. I'll try to get the EntityAlpha and/or direction change code nearer to CaptureWorld like you said though, thanks.


fox95871(Posted 2009) [#8]
Can't thank you enough Warner, works perfect now. I assume you made the EntityShow function just so you wouldn't have to alter all my longhand code? I did it anyway though, so here it is for anyone who needs perfect eight directional walking and running code:



Thanks again for the help. I still have some questions about what fixed what exactly, but whatever. I still have the rest of my engine to finish so never mind!

Bill, your suggestion worked too, but I'm a little hesitant to use it since it feels like I'm working with a wrench in an engine room. I don't want to mess with the render tween at all! Here's your suggestion in action though, it does work just as well:




fox95871(Posted 2009) [#9]
This is an old thread, but I wanted to dig it up because I just fixed a major bug with it! If anyone has problems with EntityAlpha and the render tween not getting along, try the code at the label .billssuggestion