mol17 wrote:
Whats the difference beetween flash and scratch?Is one easier, are they different styles of programming?Is one better? Well i have no idea so im hoping someone will tell me!!!>
![]()
Flash is a program used to create flash animations and programs and scratch is a simple program builder designed for beginners. Scratch is free, while flash is used by professionals and costs a lot.
Flash, unlike scratch uses a text based language.
//This is an example
onEnterFrame=function(){
trace("This will output text in a little window");
}
Capability wise, Flash is better than scratch by far. Most programming languages are much more capable than scratch but lack scratch's user friendliness.
This thread has instructions on getting a free trial version of flash (good for 30 days) and it also has a small tutorial and links to other tutorials.
http://scratch.mit.edu/forums/viewtopic.php?id=6373
Offline
keroro645 wrote:
I would like flash right now but I think it would be hard for me.
At first I didn't think I could learn AS2/3 but after like a week I could program pretty good. I can make an AI, movement, health bar, items, coins, battling.
Heres the script for good movement (AS2):
onClipEvent (load) { vx = 0; vy = 0; friction = 0.87; } onClipEvent (enterFrame) { vx *= friction; vy *= friction; this._x += vx; this._y += vy; if (Key.isDown(Key.RIGHT)) { vx += 5; } if (Key.isDown(Key.LEFT)) { vx -= 5; } if (Key.isDown(Key.DOWN)) { vy += 5; } if (Key.isDown(Key.UP)) { vy -= 5; } }
Offline
mol17, i like your signature
Offline
or for an AI that moves to your char :
\\give the enemy clip an instance of "enemy" \\give the your clip an instance of "char" onClipEvent (enterFrame) { ux = _root.char._x; uy = _root.char._y; ex = this._x; ey = this._y; if (ex>ux+1) { _x -= 5; } if (ex<ux-1) { _x += 5; } if (ey>uy+1) { _y -= 5; } if (ey<uy-1) { _y += 5; } }
Offline
or a platformer game: make a ground, call it ground, make water call it water (by call it I mean give it an instance of"whatever follows)
onClipEvent (load) { var grav:Number = 0; var run:Number = 5; var wlk:Number = 2.5; var speed:Number = run; var jumpHeight:Number = 12; var dbl:Number = 10; var tri:Number = 10; var djump:Boolean = false; var tjump:Boolean = false; var thro:Boolean = false; var slow:Number = .7; var slowspd:Number = speed/2; var setspeed:Number = speed; var scale:Number = _xscale; var ex:Number = 5; var vx:Number = 0; var friction:Number = 0.85; this.gotoAndStop(1); } onClipEvent (enterFrame) { vx *= friction; _x += vx; grav++; _y += grav; if (Key.isDown(65)) { setspeed = wlk; } else { setspeed = run; } while (_root.ground.hitTest(_x, _y, true)) { djump = false; tjump = false; _y--; grav = 0; } if (_root.water.hitTest(_x, _y, true)) { grav *= slow*1.25; speed = slowspd; } else { speed = setspeed; } if (Key.isDown(Key.RIGHT)) { vx += speed; _xscale = scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { if (djump == false) { this.gotoAndStop(2); } else if (tjump == false) { this.gotoAndStop(4); } else { this.gotoAndStop(5); } } } else if (Key.isDown(Key.LEFT)) { vx -= speed; _xscale = -scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { if (djump == false) { this.gotoAndStop(2); } else if (tjump == false) { this.gotoAndStop(4); } else { this.gotoAndStop(5); } } } else { if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(68) && !Key.isDown(83)) { this.gotoAndStop(3); } } if (Key.isDown(Key.SPACE)) { this.gotoAndStop(8); } if (Key.isDown(Key.TAB)) { this.gotoAndStop(7); } if (Key.isDown(Key.SHIFT)) { this.gotoAndStop(6); } if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) { grav = -jumpHeight; _y -= 4; this.gotoAndStop(2); } else if (Key.isDown(Key.UP) && djump == false && grav>0 && tjump == false) { grav = -dbl; djump = true; this.gotoAndStop(4); } else if (Key.isDown(68) && tjump == false && grav>1) { grav = -tri; tjump = true; this.gotoAndStop(5); } if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) { _x -= speed; } if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) { _x += speed; } if (_root.ground.hitTest(_x, _y-_height-15, true)) { grav = 1; } }
Offline
anybody like it?
Offline
please no one does?
so I took all the time to type that for nothing?
(I wish there was a sadder smily!)
Offline
Offline
terminator355 wrote:
please no one does?
![]()
so I took all the time to type that for nothing?
(I wish there was a sadder smily!)
I don't get the this.gotoAndStop(2) parts… though i like the platformer tutorial
Offline
terminator355 wrote:
or a platformer game: make a ground, call it ground, make water call it water (by call it I mean give it an instance of"whatever follows)
Code:
onClipEvent (load) { var grav:Number = 0; var run:Number = 5; var wlk:Number = 2.5; var speed:Number = run; var jumpHeight:Number = 12; var dbl:Number = 10; var tri:Number = 10; var djump:Boolean = false; var tjump:Boolean = false; var thro:Boolean = false; var slow:Number = .7; var slowspd:Number = speed/2; var setspeed:Number = speed; var scale:Number = _xscale; var ex:Number = 5; var vx:Number = 0; var friction:Number = 0.85; this.gotoAndStop(1); } onClipEvent (enterFrame) { vx *= friction; _x += vx; grav++; _y += grav; if (Key.isDown(65)) { setspeed = wlk; } else { setspeed = run; } while (_root.ground.hitTest(_x, _y, true)) { djump = false; tjump = false; _y--; grav = 0; } if (_root.water.hitTest(_x, _y, true)) { grav *= slow*1.25; speed = slowspd; } else { speed = setspeed; } if (Key.isDown(Key.RIGHT)) { vx += speed; _xscale = scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { if (djump == false) { this.gotoAndStop(2); } else if (tjump == false) { this.gotoAndStop(4); } else { this.gotoAndStop(5); } } } else if (Key.isDown(Key.LEFT)) { vx -= speed; _xscale = -scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { if (djump == false) { this.gotoAndStop(2); } else if (tjump == false) { this.gotoAndStop(4); } else { this.gotoAndStop(5); } } } else { if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(68) && !Key.isDown(83)) { this.gotoAndStop(3); } } if (Key.isDown(Key.SPACE)) { this.gotoAndStop(8); } if (Key.isDown(Key.TAB)) { this.gotoAndStop(7); } if (Key.isDown(Key.SHIFT)) { this.gotoAndStop(6); } if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) { grav = -jumpHeight; _y -= 4; this.gotoAndStop(2); } else if (Key.isDown(Key.UP) && djump == false && grav>0 && tjump == false) { grav = -dbl; djump = true; this.gotoAndStop(4); } else if (Key.isDown(68) && tjump == false && grav>1) { grav = -tri; tjump = true; this.gotoAndStop(5); } if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) { _x -= speed; } if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) { _x += speed; } if (_root.ground.hitTest(_x, _y-_height-15, true)) { grav = 1; } }
This is nice but it doesn't look like you coded it. I can tell what the code does by looking at it and it has some very specific features such as double jumping and triple jumping that I don't really think are nessary for basic platformers. Here is another script that I coded that is more general purpose.
//Coded by Archmage-flash onClipEvent (load) { var xVelocity:Number = 0; var yVelocity:Number = 0; var maxVelocity:Number = 100; var jumpPower:Number = 15; var runSpeed:Number = 6; var drag:Number = 0.7; //This variable controls the hitTest range for the walls //Don't set the wallHits variable to high, causes errors with the horzzontal wall hitTesting var wallHits:Number = _height/6; //This variable controls the top speed at which the MC can fall var maxFall:Number = 20; } onClipEvent (enterFrame) { //Left and right movement with the keys if (Math.abs(xVelocity)<=MaxVelocity) { if (Key.isDown(Key.RIGHT)) { xVelocity += runSpeed; _xscale = 100; } if (Key.isDown(Key.LEFT)) { xVelocity -= runSpeed; _xscale = -100; } } if (_root.ground.hitTest(_x, _y+(_height/2), true)) { yVelocity = -1; if (Key.isDown(Key.SPACE)) { yVelocity = -jumpPower; } } if (_root.ground.hitTest(_x, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2), _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2), _y-(_height/2), true)) { _y++; if (yVelocity<0) { yVelocity = 3; } } if (yVelocity<maxFall) { yVelocity++; } //decrease the xVelocity variable and alter x and y position by the velocity variables xVelocity *= drag; _y += yVelocity; _x += xVelocity; //raise the MC above the ground while (_root.ground.hitTest(_x, _y+(_height/2)-1, true) || _root.ground.hitTest(_x, _y+wallHits, true) || _root.ground.hitTest(_x, _y-wallHits, true)) { _y--; } //this prevents the MC from going though walls horizontally while (_root.ground.hitTest(_x+(_width/2), _y, true) || _root.ground.hitTest(_x+(_width/2), _y+wallHits, true) || _root.ground.hitTest(_x+(_width/2), _y-wallHits, true)) { _x--; xVelocity = 0; } while (_root.ground.hitTest(_x-(_width/2), _y, true) || _root.ground.hitTest(_x-(_width/2), _y+wallHits, true) || _root.ground.hitTest(_x-(_width/2), _y-wallHits, true)) { _x++; xVelocity = 0; } //code for changing the player's stance if (Key.isDown(Key.LEFT) || Key.isDown(Key.RIGHT)) { gotoAndStop(1); } else { gotoAndStop(3); } if (!_root.ground.hitTest(_x, _y+(_height/2)+jumpPower, true)) { gotoAndStop(2); } }
I used this script to make a flash version of archknight's adventure.
Last edited by archmage (2008-09-14 17:36:26)
Offline
dingdong wrote:
scratch handles a pitiful 10 sprites, flash handles a whopping 50 sprites (or more, dunno)!
I think everyone realizes that scratch wasn't built for power. It's really not big of a deal because scratch was made to be a program for beginners and beginners usually don't need a lot of power.
Offline
archmage wrote:
terminator355 wrote:
or a platformer game: make a ground, call it ground, make water call it water (by call it I mean give it an instance of"whatever follows)
Code:
onClipEvent (load) { var grav:Number = 0; var run:Number = 5; var wlk:Number = 2.5; var speed:Number = run; var jumpHeight:Number = 12; var dbl:Number = 10; var tri:Number = 10; var djump:Boolean = false; var tjump:Boolean = false; var thro:Boolean = false; var slow:Number = .7; var slowspd:Number = speed/2; var setspeed:Number = speed; var scale:Number = _xscale; var ex:Number = 5; var vx:Number = 0; var friction:Number = 0.85; this.gotoAndStop(1); } onClipEvent (enterFrame) { vx *= friction; _x += vx; grav++; _y += grav; if (Key.isDown(65)) { setspeed = wlk; } else { setspeed = run; } while (_root.ground.hitTest(_x, _y, true)) { djump = false; tjump = false; _y--; grav = 0; } if (_root.water.hitTest(_x, _y, true)) { grav *= slow*1.25; speed = slowspd; } else { speed = setspeed; } if (Key.isDown(Key.RIGHT)) { vx += speed; _xscale = scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { if (djump == false) { this.gotoAndStop(2); } else if (tjump == false) { this.gotoAndStop(4); } else { this.gotoAndStop(5); } } } else if (Key.isDown(Key.LEFT)) { vx -= speed; _xscale = -scale; if (_root.ground.hitTest(_x, _y+3, true)) { this.gotoAndStop(1); } else { if (djump == false) { this.gotoAndStop(2); } else if (tjump == false) { this.gotoAndStop(4); } else { this.gotoAndStop(5); } } } else { if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(68) && !Key.isDown(83)) { this.gotoAndStop(3); } } if (Key.isDown(Key.SPACE)) { this.gotoAndStop(8); } if (Key.isDown(Key.TAB)) { this.gotoAndStop(7); } if (Key.isDown(Key.SHIFT)) { this.gotoAndStop(6); } if (Key.isDown(Key.UP) && _root.ground.hitTest(_x, _y+3, true)) { grav = -jumpHeight; _y -= 4; this.gotoAndStop(2); } else if (Key.isDown(Key.UP) && djump == false && grav>0 && tjump == false) { grav = -dbl; djump = true; this.gotoAndStop(4); } else if (Key.isDown(68) && tjump == false && grav>1) { grav = -tri; tjump = true; this.gotoAndStop(5); } if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) { _x -= speed; } if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) { _x += speed; } if (_root.ground.hitTest(_x, _y-_height-15, true)) { grav = 1; } }This is nice but it doesn't look like you coded it. I can tell what the code does by looking at it and it has some very specific features such as double jumping and triple jumping that I don't really think are nessary for basic platformers. Here is another script that I coded that is more general purpose.
Code:
//Coded by Archmage-flash onClipEvent (load) { var xVelocity:Number = 0; var yVelocity:Number = 0; var maxVelocity:Number = 100; var jumpPower:Number = 15; var runSpeed:Number = 6; var drag:Number = 0.7; //This variable controls the hitTest range for the walls //Don't set the wallHits variable to high, causes errors with the horzzontal wall hitTesting var wallHits:Number = _height/6; //This variable controls the top speed at which the MC can fall var maxFall:Number = 20; } onClipEvent (enterFrame) { //Left and right movement with the keys if (Math.abs(xVelocity)<=MaxVelocity) { if (Key.isDown(Key.RIGHT)) { xVelocity += runSpeed; _xscale = 100; } if (Key.isDown(Key.LEFT)) { xVelocity -= runSpeed; _xscale = -100; } } if (_root.ground.hitTest(_x, _y+(_height/2), true)) { yVelocity = -1; if (Key.isDown(Key.SPACE)) { yVelocity = -jumpPower; } } if (_root.ground.hitTest(_x, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2), _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2), _y-(_height/2), true)) { _y++; if (yVelocity<0) { yVelocity = 3; } } if (yVelocity<maxFall) { yVelocity++; } //decrease the xVelocity variable and alter x and y position by the velocity variables xVelocity *= drag; _y += yVelocity; _x += xVelocity; //raise the MC above the ground while (_root.ground.hitTest(_x, _y+(_height/2)-1, true) || _root.ground.hitTest(_x, _y+wallHits, true) || _root.ground.hitTest(_x, _y-wallHits, true)) { _y--; } //this prevents the MC from going though walls horizontally while (_root.ground.hitTest(_x+(_width/2), _y, true) || _root.ground.hitTest(_x+(_width/2), _y+wallHits, true) || _root.ground.hitTest(_x+(_width/2), _y-wallHits, true)) { _x--; xVelocity = 0; } while (_root.ground.hitTest(_x-(_width/2), _y, true) || _root.ground.hitTest(_x-(_width/2), _y+wallHits, true) || _root.ground.hitTest(_x-(_width/2), _y-wallHits, true)) { _x++; xVelocity = 0; } //code for changing the player's stance if (Key.isDown(Key.LEFT) || Key.isDown(Key.RIGHT)) { gotoAndStop(1); } else { gotoAndStop(3); } if (!_root.ground.hitTest(_x, _y+(_height/2)+jumpPower, true)) { gotoAndStop(2); } }I used this script to make a flash version of archknight's adventure.
cool, upload it to http://www.spamtheweb.com or http://www.flashgamelicense.com
and post the link here...
also in "show and tell look at the topic "My Flash Game" to see what I used it for...
awesome though, I want to see it
Last edited by terminator355 (2008-09-14 22:01:57)
Offline
Bluestribute wrote:
terminator355 wrote:
please no one does?
![]()
so I took all the time to type that for nothing?
(I wish there was a sadder smily!)
I don't get the this.gotoAndStop(2) parts… though i like the platformer tutorial
it means that you goto the frame on the timeline inside that movie clip
Offline
terminator355 wrote:
Bluestribute wrote:
terminator355 wrote:
please no one does?
![]()
so I took all the time to type that for nothing?
(I wish there was a sadder smily!)
I don't get the this.gotoAndStop(2) parts… though i like the platformer tutorial
it means that you goto the frame on the timeline inside that movie clip
Well, I know that. But I saw Archmage's .fla tutorial of it, and his MC didn't have any timeline clips (or maybe one), yet he had the same thing
Offline
mol17 wrote:
umm bluestribute, your confusing me.just tell me WICH ONES BETTER!!!hufff huff, sorry, i im kinda out of it today.
>
![]()
Flash Actionscript 2.0 (if you get CS, use 2.0)
Offline
Bluestribute wrote:
Well, I know that. But I saw Archmage's .fla tutorial of it, and his MC didn't have any timeline clips (or maybe one), yet he had the same thing
YES IT DID
http://spamtheweb.com/ul/upload/140908/86323_platformer_engine.php
arrow keys for movement and space bar to jump.
Notice how the MC changes it's animations when you move him around? That's because I put different frames in the MC's timeline.
Offline
Bluestribute wrote:
mol17 wrote:
umm bluestribute, your confusing me.just tell me WICH ONES BETTER!!!hufff huff, sorry, i im kinda out of it today.
>
![]()
Flash Actionscript 2.0 (if you get CS, use 2.0)
Sorry but AS3 is MUCH more efficient. AS2 is easier though.
Offline
archmage wrote:
Bluestribute wrote:
Well, I know that. But I saw Archmage's .fla tutorial of it, and his MC didn't have any timeline clips (or maybe one), yet he had the same thing
YES IT DID
![]()
http://spamtheweb.com/ul/upload/140908/86323_platformer_engine.php
arrow keys for movement and space bar to jump.
Notice how the MC changes it's animations when you move him around? That's because I put different frames in the MC's timeline.
i new it, i dont think there is another way to do it
Offline
beside morphing it with AS which is HARD
Offline