-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix style lockon #179
Fix style lockon #179
Conversation
That makes it official! :D
…l eliminate the silly look ups (and those warnings). This will affect `Keyboard` and `FrameRecord` class. `FlxSprite` got a safe cast of `_animation[i].name as FlxAnim`. `_animation` array only holds `FlxAnim`.
…sh the camera go an offset by 1.
This issue accidentally includes a few too many commits, but this is the commit that is relevant: Can someone help me figure out why this problem is occurring (and why the fix works)? As I said in the pull request, I simply made the solution already created by @krix available as a pull request, and haven't personally seen this bug or fix in action. |
You can play here: |
I've located the merge that caused all those non-disapearing particles in Mode: 8b1424e. I don't know if the bug has anything to do with I'm still trying to pinpoint the problematic line of the code. I'll dig a little bit more. |
As for the "lockon" style, it's still not clear to me what that part of the camera code does behind the scenes, therefore, I would love it if someone else looked into this issue. However, I do have two cents. I'm really not a fan of just having that arbitrary |
I've checked commit 1f19b26 that caused the STYLE_LOCKON issue. This commit claims to fix the "camera follow jitters" issue, however I was not able to see that fix working. Does anyone have an idea of how I can test the jitter fix? That fix adds a lot of |
Hi Dovyski, I implemented that fix in the first place, so I'm pretty sure it works :) There is also a link to a playable demo to see the fix working: Unfortunately, it shows only the fixed version. But you should be able to compile the project again without the fix to see the difference. You'll find the source code of the demo is here: https://github.com/krix/CameraScrollFix I hope this helps. Regards, |
Hi @krix ! Thanks for joining the discussion and for providing more info on it! They were very useful :) Indeed the fix works. I've compiled your playable demo against the current release of Flixel and Flixel Community (dev). The problem is very perceptible. All we have to do now is figure out why there is an offset by 1 happening. |
Ok, guys, got some weird stuff. I removed the First I created a simple code to test the camera style and the sprite that got locked on. I could reproduce the bug easily. So I test this against flixel-gdx to compare the values of deadzone. Both are the same. Then I ran Mode checking the targetX and Y in The values from one of the camera
flixel-gdx In flixel-gdx it rounds down. Strange it should round up.
There is nothing wrong with To fix this bug, it should round down using |
That's really weird stuff, @WingEraser! I've played a bit with @krix 's code replacing Maybe @krix can shed some light on this, but I think we are safe to create a new pull request containing just the fix I've tried. What do you guys think? |
@krix also added Seems working fine without it. |
Maybe those |
We can remove
I just tested this with ParticleDemo from the website. What I did is surrounding the screen with walls so the particles can’t escape. Then I emit 20 particles by each click. You’ll see that the particles that got disappeared will reappear and continues on the screen. The demo doesn’t use |
Ok found the culprit, it’s |
Yeah, sorry, @Dovyski fixed and merged that part already. See #30 (comment) The only problem that remains is the "off by one pixel" issue. |
Ok guys, I'm a bit out of this matter, but I will try to help. |
I've followed @WingEraser's findings and @krix's tips to create a new pull request. It fixes the offset by one problem and does not interfere with the camera jittering fix. I've tested the fix against Mode and one of my games. Both worked pretty fine. I've also added a new test case |
Fixed in:
|
Changed the deadzone for STYLE_LOCKON. Notice the +1. It seems in Flash the camera go an offset by 1.
deadzone = new FlxRect(((width-w)/2)+1,((height-h)/2)+1,w,h);
Run Mode as reference.