Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript Gaming

Status
Not open for further replies.

Middy13

Programmer
Joined
Mar 27, 2005
Messages
3
Location
US
I'm really new to actionscript and I am attempting to make a game. I can make a object move around using the keyboard but I do not know how to make a object rotate when a key is pressed. I also need to have some type of gravity. So when I press right on the keyboard the object will stay on the terrain, even if there is a hill. So...

1. How do I make an object rotate when a key is pressed.

2. How do I make some sort of gravity to keep an object on the ground.

Any help is greatly appreciated, thanks.
 
Normal Method For Making A Button: Create a simple button with animation on roll over

Ascii = Key.getAscii()String = String.fromCharCode(Key.getAscii())
Code = Key.getCode()

_____________________
arrowkeys
Ascii() | String | Code
0 | (left) | 37
0 | (up) | 38
0 | (down) | 40
0 | (right) | 39

Ascii() | String | Code
27 .(esc) 27
8 .(backspace) 8
0 (capslock) 20
0 (shift) 16
(alt) 18
0 (ctrl) 17
13 (enter) 13
32 (space) 32

function keys
Ascii() | String | Code
0 (F1) 112
0 (F2) 113
0 (F3) 114
0 (F4) 115
0 (F5) 116
0 (F6) 117
0 (F7) 118
0 (F8) 119
0 (F9) 120
0 (F10) 121
0 (F11) 122
0 (F12) 123

letters and other main keyboard w/shift key on
Ascii() | String | Code
126 ~ 192
33 ! 49
64 @ 50
35 # 51
36 $ 52
37 % 53
94 ^ 54
38 & 55
42 * 56
40 ( 57
41 ) 48
95 _ 189
43 + 187
124 | 220
81 Q 81
87 W 87
69 E 69
82 R 82
84 T 84
89 Y 89
85 U 85
73 I 73
79 O 79
80 P 80
123 { 219
125 } 221
65 A 65
83 S 83
68 D 68
70 F 70
71 G 71
72 H 72
74 J 74
75 K 75
76 L 76
58 : 186
34 " 222
90 Z 90
88 X 88
67 C 67
86 V 86
66 B 66
78 N 78
77 M 77
60 < 188
62 > 190
63 ? 191

letters and other main keyboard, no shift
Ascii() | String | Code
96 ` 192
49 1 49
50 2 50
51 3 51
52 4 52
53 5 53
54 6 54
55 7 55
56 8 56
57 9 57
48 0 48
45 - 189
61 = 187
92 \ 220
113 q 81
119 w 87
101 e 69
114 r 82
116 t 84
121 y 89
117 u 85
105 i 73
111 o 79
112 p 80
91 [ 219
93 ] 221
97 a 65
115 s 83
100 d 68
102 f 70
103 g 71
104 h 72
106 j 74
107 k 75
108 l 76
59 ; 186
39 ' 222
122 z 90
120 x 88
99 c 67
118 v 86
98 b 66
110 n 78
109 m 77
44 , 188
46 . 190
47 / 191

keypad keys w/numlock on
Ascii() | String | Code
47 / 111
42 * 106
45 - 109
55 7 103
56 8 104
57 9 105
52 4 100
53 5 101
54 6 102
49 1 97
50 2 98
51 3 99
48 0 96
46 . 110
13 13
43 + 107

keypad keys w/numlock off
Ascii() | String | Code
47 / 111
42 * 106
45 - 109
0 (Home) 36
0 (up arrow) 38
0 (PgUp) 33
0 (left arrow) 37
0 12
0 (right arrow) 39
0 (End) 35
0 (down arrow) 40
0 (PgDown) 34
0 (Ins) 45
127 (Del) 46
13 (Enter) 13
43 + 107

middlekeys
Ascii() | String | Code
0 (ScrollLock) 145
0 (Pause) 19
0 (Ins) 45
0 (Home) 36
0 (PageUp) 33
127 (Delete) 46
0 (End) 35
0 (PageDown) 34

 
1. If we are going to start the GAME PROJECTs in Flash.Can you tell me how to START the coding i.e. How should be the flow? I am going to plan for (Fight game of two players)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top