what if you want it when you aren't pressing any keys to gotoAndPlay something else?
what if you want it when you aren't pressing any keys to gotoAndPlay something else?
after all you keypresses are checked and an else goto and play blah.
At 2/10/05 05:15 PM, -JParadox- wrote: Denvish.
My anti drug.
Sweet job man, I learned a few things myself.
I hope this and your many other text tutorials help all in need.
My anti Drug Too!
so where do i put
onClipEvent(load){
speed=10; stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){_x+=speed; gotoAndStop(1);}
if (Key.isDown(Key.DOWN)){_y+=speed; gotoAndStop(2);}
if (Key.isDown(Key.LEFT)){_x-=speed; gotoAndStop(3);}
if (Key.isDown(Key.UP)){_y-=speed; gotoAndStop(1);}
}
freaken thanks man. i only ask how to keep the mc from leaving off screen.
Put the MC on the stage and add these actions:
onClipEvent(load){
speed=10; stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){_x+=speed; gotoAndStop(1);}
if (Key.isDown(Key.DOWN)){_y+=speed; gotoAndStop(2);}
if (Key.isDown(Key.LEFT)){_x-=speed; gotoAndStop(3);}
if (Key.isDown(Key.UP)){_y-=speed; gotoAndStop(1);}
}
Little problem there, : if (Key.isDown(Key.UP)){_y-=speed; gotoAndStop(1);} shouldn't that be if (Key.isDown(Key.UP)){_y-=speed; gotoAndStop(4?);} ?
At 2/10/05 06:34 PM, Denvish wrote: Basic side-scroller (walking) movement
The variable 'dir' just holds the direction in which the character is moving, so he knows which direction to face when stopped
onClipEvent(load){
speed=10; stop(); dir=0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){
_x+=speed; gotoAndStop(2); dir=0;
}else if (Key.isDown(Key.LEFT)){
_x-=speed; gotoAndStop(3); dir=1;
}else{
if (dir==0){
gotoAndStop(1);
}else{
gotoAndStop(4);
}
}
}
Pretty cool, could you make one with a four-directions movement?
That would be pretty cool =)
Want your character (top-down) to point in his movement direction when he stops?
I posted this code as a response to this thread, thought I may as well post it here too.
Your frames should be
1: right, moving - 2: down, moving - 3: left, moving - 4: up, moving
5: right, standing - 6: down, standing - 7: left, standing - 8: up, standing
onClipEvent(load){
speed=10; stop(); dir=1;moving=0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){moving=1; dir=1;}
else if (Key.isDown(Key.DOWN)){moving=1; dir=2;}
else if (Key.isDown(Key.LEFT)){moving=1; dir=3;}
else if (Key.isDown(Key.UP)){moving=1; dir=4;}
else{moving=0;}
if(moving){
gotoAndStop(dir);
}else{
gotoAndStop(dir+4);
}
}
I'm trying to make a NG halloween dress-up game, and I can click on the objects, but cant drop them. I need the stop drag code part of it. I went to kirupa.com, and got the code, but the stop drag code part won't work. Thanks in advance.
At 10/26/05 11:53 PM, Propane_Clock wrote: I'm trying to make a NG halloween dress-up game, and I can click on the objects, but cant drop them. I need the stop drag code part of it. I went to kirupa.com, and got the code, but the stop drag code part won't work. Thanks in advance.
you came to the wrong thread, darling...
try here: AS: Drag and Drop.
if i may ask, what made you come to AS: Basic Movement to ask that question?
that makes less sense than making a new thread about your question when AS: Main holds all your answers.
At 2/10/05 06:36 PM, Denvish wrote:At 2/10/05 06:34 PM, Denvish wrote: Basic side-scroller (walking) movementThat snippet assumes that frame 1 is stationary facing right, frame 2 is moving right, frame 3 is moving left, frame 4 is stationary facing left. Don't ask why they're in that order... ;)
how do you make it shoot and kill an enimy
Yummy
At 7/14/05 05:45 PM, Fbi-bp wrote: i learnd alot in this topic. thx
how you make it shoot
Yummy
At 10/8/05 09:09 AM, Denvish wrote: Want your character (top-down) to point in his movement direction when he stops?
I posted this code as a response to this thread, thought I may as well post it here too.
Your frames should be
1: right, moving - 2: down, moving - 3: left, moving - 4: up, moving
5: right, standing - 6: down, standing - 7: left, standing - 8: up, standing
onClipEvent(load){
speed=10; stop(); dir=1;moving=0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){moving=1; dir=1;}
else if (Key.isDown(Key.DOWN)){moving=1; dir=2;}
else if (Key.isDown(Key.LEFT)){moving=1; dir=3;}
else if (Key.isDown(Key.UP)){moving=1; dir=4;}
else{moving=0;}
if(moving){
gotoAndStop(dir);
}else{
gotoAndStop(dir+4);
}
}
I wanna do something final fight like....it all seems good and works in the right directions except left down which i'd want as the left walking motion.... also someone posted a wall AS on one of these boards but it doesn't seem to work when i imput it and i'm not sure what it is.... theres alot of other things i need to find/figure out for my streets of rage style game but these two things that i presented are the things that are effecting me the most.....
great man!! i can finaly make a simple game with this...
Rhinan wanted to know how to make buttons.
Do this:
Draw a button. Go to Insert>convert to symbol.
Name it anything!
Right click>actions
Paste this code for a game:
on (press) {
nextFrame();
}
This for a movie:
on (press) {
play();
}
Those are play buttons. You can change the action by deleting the bold. And typing in something else
on (press) {
nextFrame();
}
im new to flash
i have got the movement working-- but i need to get my person to jump using space bar
i kno you proberly thinking OMG another beginer asking for stupid easy help..
so could you help me please..
At 2/20/06 08:33 AM, Evil-Entety wrote: im new to flash
i have got the movement working-- but i need to get my person to jump using space bar
i kno you proberly thinking OMG another beginer asking for stupid easy help..
so could you help me please..
If you have read the first post a few more times and try things out with it you would have found out yourself.
If you wish to use the WASD keys, the keycodes are:
At, some moment, Devish wrote:
WASD -- ARROWS -- A.KEYS
- (68) ------ (39) ------ (Key.RIGHT)
- (65) ------ (37) ------ (Key.LEFT)
- (87) ------ (38) ------ (Key.UP)
- (83) ------ (40) ------ (Key.DOWN)
Use them like this:
_x+=Key.isDown(39)
or
if (Key.isDown(39)){_x+=speed;}
Other useful ones:
SPACE -------- (32)
ALT ------------ (18)
ENTER -------- (13)
BACKSPACE --- (8)
SHIFT --------- (16)
Z --------------- (90)
X --------------- (88)
C -------------- (67)
i added something to ur code denvish but if i hit the arrow key twice in a row it'll play dir 1 or whatever. (i.e. i hit right, it plays fraem4, i let up and hit it agin, i now plays frame 1)
onClipEvent(load){
speed=5; stop(); dir=1; olddir=1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){moving=1; dir=1;}
else if (Key.isDown(Key.DOWN)){moving=2; dir=2;}
else if (Key.isDown(Key.LEFT)){moving=3; dir=3;}
else if (Key.isDown(Key.UP)){moving=4;dir=4;}
else{moving=0;}
if(moving){
_x += (dir == 1 ? speed : dir == 3 ? -speed : 0);
_y += (dir == 2 ? speed : dir == 4 ? -speed : 0);
if(dir!==olddir){
gotoAndStop(dir);
}
}else{
gotoAndStop(dir+4);
}
olddir=dir;
}
any help?
I think AS: Main now needs an uber basic section :P
which one is the one for side scrolling with orientation???
does anyone has a code for collision walls , you see i used this code from the denvish archives (yes i call it that , i am a fan)
Left, right, down, up movement with orientation
Create a new MC with 4 frames.
On the first frame, add your character walking right.
On the second frame, add your character walking down.
Third frame, left. Fourth frame, up.
Put the MC on the stage and add these actions:
onClipEvent(load){
speed=10; stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){_x+=speed; gotoAndStop(1);}
if (Key.isDown(Key.DOWN)){_y+=speed; gotoAndStop(2);}
if (Key.isDown(Key.LEFT)){_x-=speed; gotoAndStop(3);}
if (Key.isDown(Key.UP)){_y-=speed; gotoAndStop(1);}
}
---------------------------------
now can someone give me a collision wall code because i am like making a room blah blah and stuff so....CODE ME UP SCOTTY !
How do I get something to walk with the WASD keys
Get Fuckle'd
this tells you every scancode for every key on the keyboard.
Actionscript keycodes
A
65
B
66
C
67
D
68
E
69
F
70
G
71
H
72
I
73
J
74
K
75
L
76
M
77
N
78
O
79
P
80
Q
81
R
82
S
83
T
84
U
85
V
86
W
87
X
88
Y
89
Z
90
0
48
1
49
2
50
3
51
4
52
5
53
6
54
7
55
8
56
9
57
Backspace
8
Tab
9
Clear
12
Enter
13
Shift
16
Control
17
Alt
18
Caps Lock
20
Esc
27
Spacebar
32
Page Up
33
Page Down
34
End
35
Home
36
Left Arrow
37
Up Arrow
38
Right Arrow
39
Down Arrow
40
Insert
45
Delete
46
Help
47
Num Lock
144
; :
186
= +
187
- _
189
/ ?
191
` ~
192
[ {
219
\ |
220
] }
221
" '
222
What are all these numbers and letters?? Is this for Macromedia Flash 8?? Can Someone explain clearly?
All Eyez On Me.