- Home
- Tutorials
- Flash
- Intermediate
- Simple 3D programming for AS2.0
Simple 3D programming for AS2.0
This article has been added to your 'Articles to Read' list.

Detecting keys
//Simple function to detect the keys pressed by the user. We just change the offsets and angles. function checkKeys() { if (Key.isDown(Key.RIGHT)) { xOffset += 4; } if (Key.isDown(Key.LEFT)) { xOffset -= 4; } if (Key.isDown(Key.UP)) { yOffset -= 4; } if (Key.isDown(Key.DOWN)) { yOffset += 4; } if (Key.isDown(Key.INSERT)) { angleY -= 0.001; } else { if (Key.isDown(Key.DELETEKEY)) { angleY += 0.001; } else { angleY *= 0.95; } } if (Key.isDown(Key.HOME)) { angleX += 0.001; } else { if (Key.isDown(Key.END)) { angleX -= 0.001; } else { angleX *= 0.95; } } if (Key.isDown(Key.PGDN)) { angleZ += 0.001; } else { if (Key.isDown(Key.PGUP)) { angleZ -= 0.001; } else { angleZ *= 0.95; } } }
The only thing this function does, is to change the angle and offset vars we declared in the previous page. Im also adding a bit of "inertia".
Next section is the render function.

