Skip to main content

Posts

Showing posts from July, 2021

Post Processing Effects (Cocos Creator 3.2)

Adding post processing effects to a game helps you change the visuals dramatically with fairly low effort. So when i wanted to change the look of the game that im making using Cocos Creator i couldn't find a well documented way to do it :( The only documentation available asks us to create a flow and im' not entirely sure where that plugs in as its' surprisingly light on details.  Check for yourself   Post-processing · Cocos Creator While I was searching for answers I found somebody suggest that this should be done the old-school way.  Render to Texture and a Full-Screen Textured Quad .  Fortunately this setup was pretty easy to do within Cocos Creator. Create a Render To Texture Resource Set the game Camera target render as this resource.  Add a new Camera and a Quad to the scene (set the flags to be different from the original game objects/cam hierarchy)  Create a new post-process material for assigning to the Quad.  Create a new Post-Process Ef...

Tiled TMX Objects to Physics Objects (CocosCreator3.2)

So i've been using the Tiled editor for creating the background for the pixel art game i am making. Somewhere down the line i decided it made sense to have the walls of the level be automatically generated based on the tiled Editor instead of setting it up in the Cocos Creator. So how do you do it? 

CocosCreator 3.2 Touch to Local co-ordinates 2D

There could be scenarios where you would want to understand the position of touch within the local co-ordinate system of a 2D node. Use-cases where this is useful Moving sprites within a confined location Virtual JoyStick implementation.  So in 3.2, you first need to convert the screen coordinates to 3D coordinates then convert the 3D world co-ordinate to the Local Co-ordinate of the node. This can be done as follows.  //in touch callback.      let   touchLoc  =  event . getLocation ()      let   screenTouchLoc  =  v3 ( touchLoc .x,  touchLoc .y,  0 )         let   screen2World  =  this .stageCamera. screenToWorld ( screenTouchLoc )         let uitComponent = this .node. getComponent ( UITransform )?           let   touchLocInNode  =...