Game
Hell Tower
9 years ago

It can never be easy


Technical stuff

So this weekend i worked on level generator for creating random levels but i stuck on some Phaser/webgl bugs/features.

First one scrolling scaled tiles crops part of them its probably some lack of some resizing camera cropping area but i didnt fond yet how to do it properly.

Second one was more complicated is general problem with webgl UI it just sucks and i needed to somehow use ordinary dom elements instead. So I have connected angular js to manage UI stuff from outside of Phaser and I have used some mediator pattern to pass data between those two frameworks. I have created MediatorService on Angular dependency injection container and connect Phaser state with angular controller. Tricky part was that I needed to use angular injector from already initialized dom element instead of global angular object. I didnt work out why that was the case yet.

		
			    var domElement = document.querySelector('[data-ng-app="ui"]');
    var ui = angular.element(domElement);
    var mediator = ui.injector().get('mediatorService');
    /* in phaser state initialization */
    mediatorService.state = this;
    /* in angular controller */
    mediatorService.state.setWhateverData(dataFromAngular);
		
	

In the end i have some hybrid application where i think i will use angular for whole UI and style it with css and phaser for drawing game tiles and managing sounds and keyboard input.



0 comments

Loading...

Next up

I had concept for catching units by hand that shaters reality and pulls units into pocket dimmension.

Spell casting 102 So I have added spell particle collision detection and I have also added more spell variety. And in process of that it didn’t lose too much performance. Fire bolt Fire rain: Nova: Energy ray: Dark flame:

Battle chaos I have added factions banners to identify characters affiliation. I have also taught them to make some basic movements including wall climbing. Next step I will add pathfinding so they could start making more advanced maneuvers.

Spell casting 101 I have started to work on battle system so I have created my first spell casting animations for creatures.

Pointless battle I have put spell casting animations inside game engine I still have to work out damage system but this his how it looks now: I will have to also find a way to differentiate characters fraction.

Validating objects position I have added UI elements for dragging and placing objects on map. While dragging each objects checks if it has valid ground to stand on enough free place and valid background in case of for example windows.

Burn those veggies! Now lava interacts with some less durable vegetation and destroys it on collision.

Shadow dweller Pigmey

Map generation Perlin noise composited with some gradients and rotating generation space creates this:

Parallax secrets