Camera Issue?

29 views
Skip to first unread message

xhunterko

unread,
Mar 12, 2016, 9:35:26 AM3/12/16
to HaxeFlixel
So, I'm trying to create a dungeon crawler. In the game, you descend through the dungeon one room at a time. Then every 5 rooms, the dungeon widens out and you can explore it a little bit. I have spawners:

http://pastebin.com/We5BNEC0

That create enemies:

http://pastebin.com/QjiW6Sxk

Now. Then in my game state, I have checks for when the floor changes to switch the camera. to a screen by screen movement. Currently, in create, I have the camera doing this:

        //this is in create

FlxG.camera.setBounds(FlxG.camera.x, FlxG.camera.y, 640, 480, true);      
//FlxG.camera.setBounds(FlxG.camera.x, FlxG.camera.y, 3200, 480, true); 
       
FlxG.camera.follow(PlayerKnight, FlxCamera.STYLE_SCREEN_BY_SCREEN);

I was doing something like this:

   
       
//This is in update
         
//Camera and Light
       
if (Stage < 5 || Stage > 5)
       
{            
            vis
.loadMap(640);    
           
FlxSpriteUtil.bound(PlayerKnight, 0, 640, 0, 480);
       
}    
       
       
if (Stage == 5)
       
{                    
            vis
.loadMap(3200);        
           
           
FlxSpriteUtil.bound(PlayerKnight, 0, 3200, 0, 480);
           
FlxG.camera.follow(PlayerKnight, FlxCamera.STYLE_SCREEN_BY_SCREEN);
       
}

That worked fine. UNTIL I noticed the bug. In Stage 5, in the first room, I had spawners scatter throughout the level. The spawners were working just fine, popping enemies out. Stage 5 consists of 4 rooms connected to each other with the 4th being a boss room. .When I started in the fourth room to check the spawners, they worked fine. Good, I thought, and prepared to move ahead until I noticed zombies coming out from under the walls on the left. This should not be happening. I wondered why, so I went through the level to check the other spawners. The other spawners weren't spawning. No enemies were coming from them at all. To check, I gave the spawner a choppy animation to have something visual to go by when they spawned. I checked with that, and, still no enemies but there were wall zombies. So I edited the level to have only one spawner in the boss room. I ran the level, waited, and zombies came from under the left wall. I went over to the spawner in the boss chamber to check. Sure enough, it was opening and closing like it should. Then I noticed something curious. An enemy would spawn, but then it would immediately teleport away to the far left at the starting room.

I am completely stunned at this bug. I have no idea what could be causing it or how to fix it. To see this bug for yourself, please run the test swf:

http://www.newgrounds.com/dump/item/d7cd4b6dba624e3e7d94e1333714502d

Apologies for the long load, but please take a look at it. To encounter the bug quickly, when the game starts up, tap the N key to go to stage 5. Then wait a couple minutes, and you should see some zombies coming from under the wall to the left. If you don't, navigate to the far right of the level using the arrow keys to watch the spawner do it's spawning animation. Occasionally, you will see an enemy, then see it quickly teleport away in a flash. Then go back to the first room and there should be some zombies there. I have no idea what's causing this.

Please help me with this issue if you have the time. Thanks!

Ashiq A.

unread,
Mar 12, 2016, 11:00:05 AM3/12/16
to haxef...@googlegroups.com
General comments: are you able to debug? (Which IDE are you using?) Setting breakpoints and inspecting variables is much, much quicker.

Also, are you able to comment out blocks of code and isolate the problem? Are you able to pare it down to a minimal set of code or the smallest possible example that shows the problem?

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at https://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/dec33421-987b-4e3f-b964-283db9522e5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

xhunterko

unread,
Mar 12, 2016, 8:43:39 PM3/12/16
to HaxeFlixel
Issue resolved. Was some old code left in the project.
Reply all
Reply to author
Forward
0 new messages