Kah Shiu Chong

A graduate in Physics, acquainted with Actionscript 2.0 as a introduction to programming and got hooked ever since. Currently serving as instructor in University College of Technology and Innovation, Malaysia.

- How to Detect When an Object Has Been Circled By a GestureYou're never too old for a game of Spot the Difference - I remember playing it as a kid, and I now find my wife still plays it occasionally! In this tutorial, we'll look at how to detect when a ring has been drawn around an object, with an algorithm that could be used with mouse, stylus, or touchscreen input.You're never too old for a game of Spot the Difference - I remember playing it as a kid, and I now find my wife still plays it occasionally! In this tutorial, we'll look at how to detect when a ring has been drawn around an object, with an algorithm that could be used with mouse, stylus, or touchscreen input.Read More…
- Collision Detection Using the Separating Axis TheoremThe Separating Axis Theorem is often used to check for collisions between two simple polygons, or between a polygon and a circle. As with all algorithms, it has its strengths and its weaknesses. In this tutorial, we'll go over the math behind the theorem, and show how it can be used in game development with some sample code and demos.The Separating Axis Theorem is often used to check for collisions between two simple polygons, or between a polygon and a circle. As with all algorithms, it has its strengths and its weaknesses. In this tutorial, we'll go over the math behind the theorem, and show how it can be used in game development with some sample code and demos.Read More…
- The Math and ActionScript of Curves: Gradients and NormalsWe've tackled drawing curves, and finding their quadratic and cubic roots, as well as handy applications for using quadratic roots within games. Now, as promised, we'll look at applications for finding cubic roots, as well as curves' gradients and normals, like making objects bounce off curved surfaces. Let's go!We've tackled drawing curves, and finding their quadratic and cubic roots, as well as handy applications for using quadratic roots within games. Now, as promised, we'll look at applications for finding cubic roots, as well as curves' gradients and normals, like making objects bounce off curved surfaces. Let's go!Read More…
- The Math and ActionScript of Curves: RootsIn the first tutorial of this series, we took a look at drawing curves using equations and AS3. Now, we're going to tackle solving those equations to find the roots of a curve - that is, the places where the curve crosses a given straight line. We can use this to predict collisions with curved surfaces, and to avoid "tunnelling" in Flash games.In the first tutorial of this series, we took a look at drawing curves using equations and AS3. Now, we're going to tackle solving those equations to find the roots of a curve - that is, the places where the curve crosses a given straight line. We can use this to predict collisions with curved surfaces, and to avoid "tunnelling" in Flash games.Read More…
- The Math and ActionScript of Curves: Drawing Quadratic and Cubic CurvesWe see lines used in a lot of scenarios. Curves are also used, although perhaps not as frequently - but that doesn't undermine their importance! In this tutorial we shall take a closer look at curves, particularly the quadratic and cubic curve, along with some of their commonly used mathematical features.We see lines used in a lot of scenarios. Curves are also used, although perhaps not as frequently - but that doesn't undermine their importance! In this tutorial we shall take a closer look at curves, particularly the quadratic and cubic curve, along with some of their commonly used mathematical features.Read More…
- Pixel-Level Collision Detection Based on Pixel ColorsIn this tutorial, I'll follow the approach suggested by Richard Davey (Thanks, Richard!), and used by him and others, in detecting collisions between bitmaps with a subtle modification. I'll also compare performance between various approaches of bitmap collision detection using Grant Skinner's PerformanceTest harness.In this tutorial, I'll follow the approach suggested by Richard Davey (Thanks, Richard!), and used by him and others, in detecting collisions between bitmaps with a subtle modification. I'll also compare performance between various approaches of bitmap collision detection using Grant Skinner's PerformanceTest harness.Read More…
- Predicting Collision Points With Math in AS3In my previous tutorial about collision detection between a circle and a line, I covered projection on a line using the dot product of a vector. In this tutorial, we shall look at the perpendicular dot product and use it to predict the point of intersection for two lines.In my previous tutorial about collision detection between a circle and a line, I covered projection on a line using the dot product of a vector. In this tutorial, we shall look at the perpendicular dot product and use it to predict the point of intersection for two lines.Read More…
- Starling Particle Effects for Stage3D Shooter GamesI'm sure Stage3D is not foreign to most readers; it's the new API that gives AS3 programmers access to the GPU. However, coding against opcodes in Stage3D may not be everyone's preferred choice, so it's fortunate that there's a shortcut: Starling, a library developed to encapsulate this low level programming to make it much easier. And along with Starling comes its particle effects extension. In this tutorial, we'll check out the particle systems of this framework, and see its applications applied to a shoot-'em-up game.I'm sure Stage3D is not foreign to most readers; it's the new API that gives AS3 programmers access to the GPU. However, coding against opcodes in Stage3D may not be everyone's preferred choice, so it's fortunate that there's a shortcut: Starling, a library developed to encapsulate this low level programming to make it much easier. And along with Starling comes its particle effects extension. In this tutorial, we'll check out the particle systems of this framework, and see its applications applied to a shoot-'em-up game.Read More…
- Pixel-Level Collision Detection for Transformed GraphicsIn the previous tutorial, we went through the basics of pixel-level collision detection. In this tutorial, we shall explore the use of matrices in better defining the area of interest - very useful for graphics that have been rotated, translated, or skewed.In the previous tutorial, we went through the basics of pixel-level collision detection. In this tutorial, we shall explore the use of matrices in better defining the area of interest - very useful for graphics that have been rotated, translated, or skewed.Read More…
- Understanding Affine Transformations With Matrix MathematicsInspired by Prof. Wildberger in his lecture series on linear algebra, I intend to implement his mathematical ideas with Flash. We shall not delve into the mathematical manipulation of matrices through linear algebra: just through vectors. This understanding, although diluting the elegance of linear algebra, is enough to launch us into some interesting possibilities of 2x2 matrix manipulation. In particular, we'll use it to apply various shearing, skewing, flipping, and scaling effects to images at runtime.Inspired by Prof. Wildberger in his lecture series on linear algebra, I intend to implement his mathematical ideas with Flash. We shall not delve into the mathematical manipulation of matrices through linear algebra: just through vectors. This understanding, although diluting the elegance of linear algebra, is enough to launch us into some interesting possibilities of 2x2 matrix manipulation. In particular, we'll use it to apply various shearing, skewing, flipping, and scaling effects to images at runtime.Read More…
- Pixel-Level Collision DetectionUp until now, our collision detection methods have been mathematically based. Although this is helpful, there are cases where the mathematical approach is just not worth it, such as with an irregular, organic shape - the computations required are too complex and expensive to justify. Instead, we can check each individual pixel of the shapes. This is also an expensive approach, but it can at least be optimised.Up until now, our collision detection methods have been mathematically based. Although this is helpful, there are cases where the mathematical approach is just not worth it, such as with an irregular, organic shape - the computations required are too complex and expensive to justify. Instead, we can check each individual pixel of the shapes. This is also an expensive approach, but it can at least be optimised.Read More…
- Vector Regions: Hiding From a Field of ViewPreviously, we explored the approach of using vector regions to implement the field of view of a turret. Troops approached the turret on open field and no hindrances lay between them. Now suppose there is a hinderance, say a wall, that obscures the visibility of troop from turret; how should we implment that? This tutorial suggest an approach to tackle this issue.Previously, we explored the approach of using vector regions to implement the field of view of a turret. Troops approached the turret on open field and no hindrances lay between them. Now suppose there is a hinderance, say a wall, that obscures the visibility of troop from turret; how should we implment that? This tutorial suggest an approach to tackle this issue.Read More…