SOTW#15:Sao

 

 Character walking, Flash
Fire G
Posted: Nov 12 2006, 04:07 PM


BanneD Indefinitely
*

Group: Banned
Posts: 291
Member No.: 34
Joined: 4-November 06



This can be used for making all sorts of games.
This will make a character walk left/right when the appropriate arriw keys are pressed.

First, draw your character facing left, convert that to a movieclip.

Go into the movieclip (double click it) and in the second frame, create a new movieclip, and inside of it, draw your character walking to the right.
Now, go back to the first movieclip you made and go to the third frame, draw your character facing left. In the fourth frame, make a new movieclip of your character walking to the left.

Now, exit all the movieclips.
Now, apply this actionscript to the main movieclip:
(press F9 to open actionscript panel)

CODE
onClipEvent (load) {
moveSpeed = 5;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.keydown = "right"
this._x += moveSpeed;
this.gotoAndStop(2);
} else {
if (_root.keydown == "right") {
this.gotoAndStop(1);
}
}
if (Key.isDown(Key.LEFT)) {
_root.keydown = "left"
this._x -= moveSpeed;
this.gotoAndStop(4);
} else {
if (_root.keydown == "left") {
this.gotoAndStop(3);
}
}
}
onClipEvent (load) {
if (Key.isDown(Key.RIGHT))(false); {
this.gotoAndStop(1);
}
}


Feel free to edit it all you want, and enjoy.


--------------------
user posted image
+ Joofhart
Posted: Nov 12 2006, 11:34 PM


Veteran
Group Icon

Group: Elite Member
Posts: 738
Member No.: 15
Joined: 24-September 06



this for games?

just tested it, and omg i love you! though i probly wont use it but it is good!

This post has been edited by joofhart on Nov 12 2006, 11:38 PM


--------------------


Human Crew so far:
Joofhart (me)
Desi
Rafial

user posted image
Gifts
[-] [-]
+ Joofhart
Posted: Nov 12 2006, 11:40 PM


Veteran
Group Icon

Group: Elite Member
Posts: 738
Member No.: 15
Joined: 24-September 06



1 problem when i let go of right he flips back to left!

This post has been edited by joofhart on Nov 12 2006, 11:40 PM


--------------------


Human Crew so far:
Joofhart (me)
Desi
Rafial

user posted image
Gifts
[-] [-]
+ Joofhart
Posted: Nov 13 2006, 02:42 AM


Veteran
Group Icon

Group: Elite Member
Posts: 738
Member No.: 15
Joined: 24-September 06



do u think u could tell me what the action script means, like an explanation for it? because its all good and well to tell me what to do but understanding it is the next thing!


--------------------


Human Crew so far:
Joofhart (me)
Desi
Rafial

user posted image
Gifts
[-] [-]
Fire G
Posted: Nov 13 2006, 03:56 PM


BanneD Indefinitely
*

Group: Banned
Posts: 291
Member No.: 34
Joined: 4-November 06



Action script just tells everything what to do. Like the boss of a company. It's really (at it's core) just a mix of HTML, XHTML, and XML with PHP.

about it moving back to left, try
CODE
on (release) {
stop;
}


--------------------
user posted image
+ Joofhart
Posted: Nov 13 2006, 07:33 PM


Veteran
Group Icon

Group: Elite Member
Posts: 738
Member No.: 15
Joined: 24-September 06



that doesnt help me i dont understand the action script can u explain what it does!


--------------------


Human Crew so far:
Joofhart (me)
Desi
Rafial

user posted image
Gifts
[-] [-]
+ Joofhart
Posted: Nov 13 2006, 07:39 PM


Veteran
Group Icon

Group: Elite Member
Posts: 738
Member No.: 15
Joined: 24-September 06




i know that the action script controls things, i probly know more about html and web stuff then you.

i just want you to explain how that particular piece of action script works!because its good to know the action script but to understand what it does can help you edit it later!


--------------------


Human Crew so far:
Joofhart (me)
Desi
Rafial

user posted image
Gifts
[-] [-]
Fire G
Posted: Nov 13 2006, 08:01 PM


BanneD Indefinitely
*

Group: Banned
Posts: 291
Member No.: 34
Joined: 4-November 06



this code makes it so that when the clip loads whenever you press the Right arrow button is pressed it displays your avatar (the thing you drew) moving right. *see coding lines 4-11*
Lines 14-20 tells it when the Left arrow is pressed it displays your avatar moving Left.
Lines 24-26 tell it that on load (like if no buttons are press or they refresh the page) to start it over at the right.

I hope this helps you. If you need more help go here.


--------------------
user posted image
+ Joofhart
Posted: Nov 13 2006, 08:08 PM


Veteran
Group Icon

Group: Elite Member
Posts: 738
Member No.: 15
Joined: 24-September 06



how do i change which buttons i want to do?
i already knew how that worked!


--------------------


Human Crew so far:
Joofhart (me)
Desi
Rafial

user posted image
Gifts
[-] [-]
Fire G
Posted: Nov 13 2006, 08:12 PM


BanneD Indefinitely
*

Group: Banned
Posts: 291
Member No.: 34
Joined: 4-November 06



Like if you wanted it to go up instead of right you would just replace each right with up. I believe you can do this with letters but I wouldn't suggest that.

List of key names:

control = CRTL (might need to be lowercase)
shift = SHIFT (might need to be lowercase)
space bar = SPACE (might need to be lowercase)
Alter key = ALT (might need to be lower case)
Up arrow = up
Left arrow = left
Right arrow = right
down arrow = down


--------------------
user posted image
mokata
Posted: Jan 14 2007, 04:56 PM


Art Learner
*

Group: Members
Posts: 20
Member No.: 96
Joined: 14-January 07



why would you want to change it all though? like make left up and so on


--------------------
user posted image
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:





Artistic Creations Affiliates
   
Digital Lounge Brendan Hart Star Wars Aventures Sketch Art Designs™ Artistic_Creations
 

Hosted for free by InvisionFree (Terms of Use: Updated 7/7/05) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.4219 seconds | Archive
Skin created by This Is My Life of Self Concept.