1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 |
// dirFlag is always changing with CallInput()
// movFlag CAN ONLY be modified by dirFlag if it equals 0;
// when movFlag!=0, Movement() is sucesively called with movFlag's value
// only when player hits a wall, StopMovement() is called and movFlag=0;
// Movement can actually move the movieclip, or it can just do some calculus in the matrix
class player extends MovieClip {
#include "input.as"
// ------------------ variables ------------------
var dirFlag;
// tells the input
// enough cos it can only move 1 direction at a time:
// 4-2-6-8 == l-d-r-u
var movFlag;
// tells where the movieclip is moving
// 0 if it isnt moving
// ------------------ movement ------------------
function Movement() {
// this actually moves or does it do some matrix cool stuff?
}
function StopMovement() {
// dont call this until player has collided with wall or end
movFlag = 0;
}
// ------------------ important ------------------
function onEnterFrame() {
dirFlag = CallInput();
// lotsa stuff there
_root.dirflagtext.text = "input: "+dirFlag;
_root.movflagtext.text = "movem: "+movFlag;
}
} |