You are not logged in.
Announcement
#1 10/02/08 10:47pm
ActionScript
Alright i dl liveswif now i need actionscript codes to make a game just basic ones like the arrowkey buttons and mouse click im trying to make something cool
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#2 10/02/08 10:57pm
Re: ActionScript
ahh if it is like flash put this on a movieclip.
onClipEvent(enterFrame){
//When adding different directions copy between if and the first }
if(Key.isDown(Key.DOWN)){
this._y = this._y + insert speed here;
}
//Copy above but change DOWN for each key and _y for _x for left and right _y is inverted btw
}
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#5 10/02/08 11:21pm
Re: ActionScript
I dont have liveSwif so I dont know how it works.
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#7 11/02/08 2:23am
- jfig111
- Addict
- Registered: 29/10/07
- Posts: 288
Re: ActionScript
Okay. First of all, you make your sprite. Then go back to your scene.
Sprites are the equivelant of a movie clip.
So drag it onto your scene from the panel.
Now, get the select tool and select it. The actions panel should change. Now, scroll down on the list of action options until you hit onenterframe. Then, copy and paste your AS.
NOTE: Don't add any code with onenterframe in it. That onenterframe is there for automatic.
Games I support:
Super ShyGuy Universe, Loco Roco Bounce, Zuriki's Traveller, Teleport.
Offline
#8 11/02/08 8:26pm
Re: ActionScript
alright it works but the problem whenever i put (Key.LEFT)) or (Key.UP)) it goes right on the left arrow key and down on the up arrow key and i did change _y to _x on left
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#9 11/02/08 9:11pm
- jfig111
- Addict
- Registered: 29/10/07
- Posts: 288
Re: ActionScript
Yep, change the ys and the xs.
Moovlin RPG was made in LIveswif, in case you didn't know.
Games I support:
Super ShyGuy Universe, Loco Roco Bounce, Zuriki's Traveller, Teleport.
Offline
#10 11/02/08 9:22pm
Re: ActionScript
yeah i knew
proper code
if(Key.isDown(Key.UP)){
this._y -= insert speed here;
}
if(Key.isDown(Key.LEFT)){
this._x -= insert speed here;
}
and change the -= to += for down and right
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#11 11/02/08 9:28pm
- jfig111
- Addict
- Registered: 29/10/07
- Posts: 288
Re: ActionScript
My Moovlin code goes a little something like this:
On enter frame
{
gravity++;
_y += gravity;
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
if (Key.isDown(Key.UP) && punch == true) {
punch = false;
gotoandplay(first frame number with punch/attack action);
}
if(this.hitTest(_root.ground)){
_root.player.isJump = false;
_root.player.gravity = 0;
_root.player._y--;
}
if(this.hitTest(_root.bag) && punch == false) {
_root.bag.play();
}
Bag is the name of the enemy, you can change it around and add more enemys, all the hittests must be in the character already.
On mouse down.
}
if (Key.isDown && isJump == false) {
isJump = true;
_y -= 5;
gravity = -18;
}
On load:
{
gravity = 5;
speed = 5;
isJump = true;
punch = true;
}
You can change the speed, and gravity around to make it go faster or to stay to the ground.
For the attack animation, make a sprite with your character, and on that frame type stop();
Then make the next few frames your punch animation. At the last frame of the punch animation, put this on frame:
punch = true;
Make the instance name of the character "Player".
Games I support:
Super ShyGuy Universe, Loco Roco Bounce, Zuriki's Traveller, Teleport.
Offline
#12 11/02/08 11:41pm
Re: ActionScript
Meh looks abit simular but a trained eye notices the differences.
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#13 12/02/08 12:15am
#14 12/02/08 12:23am
Re: ActionScript
_root.player.gotoAndPlay(frame);
You know where to put that right.
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#15 12/02/08 12:39am
Re: ActionScript
what is isJump i dont get that part i entered the hittest for ground but it screwed movement up so now movement doesnt work and isJump doesnt either i click over and over again and it wont work
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#16 12/02/08 12:51am
Re: ActionScript
isJump is a variable. Or so it seems. dl moovlin source work off of that.
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#17 12/02/08 12:55am
#18 12/02/08 12:58am
Re: ActionScript
on the root frame:
var name = value;
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#19 12/02/08 1:04am
Re: ActionScript
alright well i dont get that whatever ill save moovlin RPG and keep it and save my project the whole 1 frame and hopefully jfig well help better on this but your help is great too zuriki i thinkhis is better because he has experince in liveswif and i still dont get isJump
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#20 12/02/08 1:10am
Re: ActionScript
Yes if I have a chance I will dl LiveSwif and make a platformer engine.
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#21 12/02/08 8:36pm
Re: ActionScript
alright i decided to change the view to an overhead view so i wont have to deal with jumping but how do i get it to stop when it hits a wall
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#22 12/02/08 8:49pm
Re: ActionScript
if(this.hitTest(_root.wall_bottom_side)){
this._y += speed;//if you are using speed as your variable then leave this else change to your variable or the same number for each movement speed on the keys
}
Basically that code will only work for 1 of 4 walls. jfig will probably be more help here.
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#23 12/02/08 9:03pm
Re: ActionScript
ha i got it you were a HUGE help zuriki but the code is
if(this.hitTest(_root.wall)){
this._y -= speed ;
}
but if it is the up wall change it to += if it is right change it to _x -= or left _x += thanks so much
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline
#24 12/02/08 9:05pm
Re: ActionScript
Yeah there are slight differences with LiveSwif code and true ActionScript because I downloaded it and the ActionScript code worked on flash but not LiveSwif. I didn't like the program though. No circle tool and no brush tool and very poor bitmap support not easy to make MovieClips (sprites).
[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]
Offline
#25 12/02/08 9:14pm
Re: ActionScript
well i did the thing heres the url link
www.resiststorage.org/images/test8456.swf
Ghost Leader Ready To Go
Panic at the disco gave me the ! XD
Offline