Be a Supporter!

AS: Basic Movement

  • 27,463 Views
  • 93 Replies
New Topic Respond to this Topic
Streetproject
Streetproject
  • Member since: Sep. 8, 2003
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to AS: Basic Movement Aug. 24th, 2005 @ 12:16 PM Reply

what if you want it when you aren't pressing any keys to gotoAndPlay something else?

noob-toast
noob-toast
  • Member since: May. 18, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: Basic Movement Aug. 24th, 2005 @ 12:18 PM Reply

after all you keypresses are checked and an else goto and play blah.


These new signatures can suck on mah balls. My lolis don't fit in. Lol wut what are you guys still doing on NG, move on.

BBS Signature
SupaStarZ
SupaStarZ
  • Member since: May. 27, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Basic Movement Aug. 27th, 2005 @ 09:39 PM Reply

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!

xfeelsobrokenlx
xfeelsobrokenlx
  • Member since: Sep. 25, 2005
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to AS: Basic Movement Sep. 27th, 2005 @ 08:18 PM Reply

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);}
}

caseyo
caseyo
  • Member since: May. 14, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to AS: Basic Movement Sep. 27th, 2005 @ 08:20 PM Reply

At 9/27/05 08:18 PM, xfeelsobrokenlx wrote: so where do i put

On the MC you want to "control".

DrClay
DrClay
  • Member since: Aug. 9, 2005
  • Offline.
Forum Stats
Supporter
Level 26
Gamer
Response to AS: Basic Movement Oct. 3rd, 2005 @ 04:59 PM Reply

freaken thanks man. i only ask how to keep the mc from leaving off screen.


TF2 Crew I User Icon Makers Club I Source Filmmaker Crew I
NEWGROUNDS TF2 Server: 192.223.24.28

BBS Signature
Dipshitprod
Dipshitprod
  • Member since: Mar. 13, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: Basic Movement Oct. 6th, 2005 @ 03:57 PM Reply

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?);} ?

Dipshitprod
Dipshitprod
  • Member since: Mar. 13, 2005
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to AS: Basic Movement Oct. 7th, 2005 @ 03:04 PM Reply

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 =)

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to AS: Basic Movement Oct. 8th, 2005 @ 09:09 AM Reply

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);
}
}


- - Flash - Music - Images - -

BBS Signature
FireOnAMatch
FireOnAMatch
  • Member since: Apr. 16, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to AS: Basic Movement Oct. 26th, 2005 @ 11:53 PM Reply

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.

authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to AS: Basic Movement Oct. 26th, 2005 @ 11:58 PM Reply

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.


BBS Signature
Matt-Bob-343Spark
Matt-Bob-343Spark
  • Member since: Aug. 15, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to AS: Basic Movement Nov. 13th, 2005 @ 01:13 AM Reply

At 2/10/05 06:36 PM, Denvish wrote:
At 2/10/05 06:34 PM, Denvish wrote: Basic side-scroller (walking) movement
That 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

BBS Signature
Matt-Bob-343Spark
Matt-Bob-343Spark
  • Member since: Aug. 15, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to AS: Basic Movement Nov. 13th, 2005 @ 01:15 AM Reply

At 7/14/05 05:45 PM, Fbi-bp wrote: i learnd alot in this topic. thx

how you make it shoot


Yummy

BBS Signature
kitsunez
kitsunez
  • Member since: Jul. 31, 2003
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to AS: Basic Movement Dec. 20th, 2005 @ 04:25 PM Reply

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.....

DragonFruit-Rock
DragonFruit-Rock
  • Member since: Dec. 31, 2005
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to AS: Basic Movement Jan. 2nd, 2006 @ 11:23 AM Reply

great man!! i can finaly make a simple game with this...


If a man that always tells the truth comes up to you and says that another man always tells lies, and the man who always lies come up to you and says "I'm lying", then is he?

BBS Signature
SilhoutteProductions
SilhoutteProductions
  • Member since: Nov. 13, 2005
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to AS: Basic Movement Jan. 3rd, 2006 @ 06:30 PM Reply

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();
}

demoninabottle
demoninabottle
  • Member since: May. 5, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to AS: Basic Movement Jan. 3rd, 2006 @ 06:33 PM Reply

damn, this is useful.

Evil-Entety
Evil-Entety
  • Member since: Feb. 20, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to AS: Basic Movement Feb. 20th, 2006 @ 08:33 AM Reply

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..

MadGiraffe
MadGiraffe
  • Member since: Jan. 7, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to AS: Basic Movement Feb. 20th, 2006 @ 08:37 AM Reply

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)
Evil-Entety
Evil-Entety
  • Member since: Feb. 20, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to AS: Basic Movement Feb. 20th, 2006 @ 08:39 AM Reply

thanks

Momo-the-Monkey
Momo-the-Monkey
  • Member since: Oct. 15, 2005
  • Offline.
Forum Stats
Member
Level 45
Musician
Response to AS: Basic Movement Feb. 20th, 2006 @ 10:42 AM Reply

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?


Hello, from the past!
[ PHP: Main ]

BBS Signature
TrueDarkness
TrueDarkness
  • Member since: Aug. 31, 2004
  • Offline.
Forum Stats
Member
Level 27
Blank Slate
Response to AS: Basic Movement Feb. 20th, 2006 @ 11:06 AM Reply

I think AS: Main now needs an uber basic section :P

megasugarman
megasugarman
  • Member since: Sep. 9, 2005
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to AS: Basic Movement Mar. 12th, 2006 @ 07:35 PM Reply

which one is the one for side scrolling with orientation???

megasugarman
megasugarman
  • Member since: Sep. 9, 2005
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to AS: Basic Movement Mar. 16th, 2006 @ 02:57 PM Reply

this is not working for me... help please

Chicken-pot-pie
Chicken-pot-pie
  • Member since: Jan. 28, 2006
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to AS: Basic Movement Apr. 2nd, 2006 @ 11:07 AM Reply

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 !

Girdf
Girdf
  • Member since: Mar. 22, 2005
  • Offline.
Forum Stats
Member
Level 25
Blank Slate
Response to AS: Basic Movement Apr. 5th, 2006 @ 03:59 PM Reply

sweet thanks

Fuckle
Fuckle
  • Member since: Sep. 14, 2005
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to AS: Basic Movement Apr. 8th, 2006 @ 05:37 AM Reply

How do I get something to walk with the WASD keys


Get Fuckle'd

BBS Signature
zami1
zami1
  • Member since: Oct. 3, 2005
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to AS: Basic Movement Apr. 9th, 2006 @ 10:27 AM Reply

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

ClickToPlay
ClickToPlay
  • Member since: Jan. 23, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to AS: Basic Movement Apr. 16th, 2006 @ 02:58 PM Reply

What are all these numbers and letters?? Is this for Macromedia Flash 8?? Can Someone explain clearly?


All Eyez On Me.

BBS Signature
blueyedguy
blueyedguy
  • Member since: Mar. 16, 2006
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to AS: Basic Movement May. 12th, 2006 @ 12:04 PM Reply

hello