View Full Version : Better question
Rick_the_Jackel
07-23-2006, 04:20 PM
i've come across actionscripts on SPP and i usually copy and paste them onto the action script panal....is ther a specific way action script MUST be written?
ill usually get these type of action scripts
onClipEvent(load){
moveSpeed = 5;
}
How is this SUPPOSE to look in the actionscript panal?
DeathBot
07-23-2006, 04:22 PM
The exact same thing. Maybe you got the actionscript itself wrong.
Rick_the_Jackel
07-23-2006, 04:31 PM
well right now i put it on there as
1 onClipevent(load)
2 moveSpeed = 5;)
3
4
and it seems perfectly happy with it
but if i put up..like a movement type actionscript
1 onClipEvent(enterFrame){
2 if(Key.isDown(Key.UP)){
3 this._y -= moveSpeed;
4 }
it brings up a warnning saying
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement block must be terminated by '}'
onClipEvent(enterFrame){
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Syntax error.
}
Total ActionScript Errors: 2 Reported Errors: 2
Minty
07-23-2006, 04:34 PM
that doesn't make any sence, it should give the error on the first one if anything, not on the second one...
Rick_the_Jackel
07-23-2006, 04:37 PM
so whats wrong with the action script? whats not in it that it wants?
im useing flash proffesional 8 in a new flash document
i'got the character i want to move, and theres only 1 layer...do i need specific layers?
Minty
07-23-2006, 04:58 PM
k well if you want a character to move, select him, open up his actions, and put this in:
onClipEvent (load) {
moveSpeed = 5;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
}
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
}
if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
}
if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
}
}
Rick_the_Jackel
07-23-2006, 04:59 PM
awsome, I checked the script and it said there were no errors thanks alot!
Rick_the_Jackel
07-23-2006, 05:02 PM
alright, so i got the movement...what about jumping?....when a character jumps, he will eventually reach a point where he begins to fall and land on an object,like a gravity code, i need the code for jumping, and then the code to make things like platforms, so when he lands on it, like i said, it holds him up like a platform
if i could get these codes, i can make my own game in no time
Minty
07-23-2006, 05:35 PM
k... thats a little too advanced for some1 thats just starting, but heres a great tutorial for a platformer game by darstone.
http://www.stickpageportal.com/forums/showthread.php?t=35507
That should help ya.
Rick_the_Jackel
07-23-2006, 07:11 PM
whats it mean when it says, another layer underneath? do i double click the box then add another layer?
Minty
07-23-2006, 07:17 PM
yea... u just create another layer lol.
vBulletin® v3.6.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.