121 Forum Posts by "Klemzo"
Come on guys!
Doesn't anyone know how to fix it?
Hello. Here's a script that goes to a frame ofc.
_root.attachMovie("hero", "hero_on_stage", 10000,{_x:200,_y:20});
_root.attachMovie("trail_sprite", "trail_mc", 8000);
trailbitmap = new flash.display.BitmapData(500, 350, true,0x000000);
_root.createEmptyMovieClip("trail", 1);
trail.attachBitmap(trailbitmap, 0);
trail_mc._visible = false;
yspeed = 0;
xspeed = 0;
wind = 0.0;
power = 0.75;
gravity = 0.0;
upconstant = 0.75;
friction = 0.98;
hero_on_stage.onEnterFrame = function() {
if (Key.isDown(Key.LEFT)) {
xspeed = xspeed-power;
}
if (Key.isDown(Key.RIGHT)) {
xspeed = xspeed+power;
}
if (Key.isDown(Key.UP)) {
yspeed = yspeed-power;
}
if (Key.isDown(Key.DOWN)) {
yspeed = yspeed+power;
}
xspeed = (xspeed+wind)*friction;
yspeed = (yspeed+gravity)*friction;
if(sunken == 0){
_y = _y+yspeed;
_x = _x+xspeed;
}
else{
_y = _y+(yspeed/5);
_x = _x+(xspeed/3);
}
_rotation = _rotation+xspeed;
if (_root.wall.hitTest(_x, _y, true)) {
xspeed = 0;
yspeed = 0;
_x = 76;
_y = 87;
}
if (_root.water.hitTest(_x, _y, true)) {
sunken = 1;
}
else{
sunken = 0;
}
this._rotation = this._rotation+xspeed;
_root.trail_mc.trail_sprite._x = this._x;
_root.trail_mc.trail_sprite._y = this._y;
_root.trailbitmap.draw(_root.trail_mc);
trail_rectangle = new flash.geom.Rectangle(0, 0, 500, 350);
trail_blur = new flash.filters.BlurFilter(2, 2, 3);
_root.trailbitmap.applyFilter(_root.trailbitmap, trail_rectangle, new Point(0, 0), trail_blur);
}
I wonder why it doesn't work? The bitmap is not attached, plus the hero moves weird (spinning and stuff like that)
What did I do wrong? Any help appreciated.
Thanks
Would really appreciate any script lines to start with. Really anything, but for AS2 ofc.
Well that's cool, but I can't get it to work, not with my knowledge.
Well, I'm doing it in AS2, so I can't really do AS3, plus, yeah, it's too advanced for me. I know I once got a simple 20 line script that made what I want somewhere in one tutorial but I just can't recall where ...
Any ideas where?
No replies eh? Are there any tutorials I can look at?
Hello.
What I've been trying to do for past few days is an animation of a flame/smoke coming out of ship's back. The only way I know how to do it best would be with a bitmap. Since my scripting skills are rather poor, I'm wondering what script tells to attack the bitmap to the object (in my case a ship)?
So basically when she ship flies it turn into the direction you want it to go (press the buttons). So behind it there should be a line of smoke. How can I do this efficiently? And how to make it NOT disappear after?
Anyone else?
At 4/26/10 03:05 PM, robin1232 wrote: 1. when testing a movie, it always lags, try running the .swf instead and see if the framerate is good then.
2. I've written a code much like this today, I've found a way to reduce the lag:
onClipEvent(load){
AppNum = 0;
currentDepth = 0;
}
onClipEvent(enterFrame){
//particle effects
//this makes sure there are no more than 30 instances on the screen at the same time.
if(AppNum > 30){
AppNum = 0;
}
if (currentDepth < -30){
currentDepth = 0;
}
//code you probably have too.
AppNum++;
currentDepth -= 1;
xspawn = this._x;
yspawn = this._y + 2;
_root.attachMovie("particle","particleMC "+AppNum,currentDepth,{_x:xspawn, _y:yspawn});
}
Actually, to me it doesn't lag a slightest bit, even if I shower the hero with tons of effects (blur, etc.).
I know what your problem is, you probably have a low framerate. You must use at least 50 (that's what I use) for this script to work smoothly, else, yes, it does feel like it's lagging.
And thanks for that script, I'll check it out.
Heya.
I playing around with a "space-shooter" game and I have this script that goes into the first frame, to make the player (hero) appear on the stage. The script then adds a bitmap of a line/trail that goes from the player (hero) when he moves (like if its a ship, a fire/smoke path or whatever).
So this comes directly to the first frame, on the root timeline:
_root.attachMovie("hero", "hero_on_stage", 10000,{_x:200,_y:20});
_root.attachMovie("trail_sprite", "trail_mc", 8000);
trailbitmap = new flash.display.BitmapData(500, 350, true,0x000000);
_root.createEmptyMovieClip("trail", 1);
trail.attachBitmap(trailbitmap, 0);
trail_mc._visible = false;
Then it calls the hero on stage:
hero_on_stage.onEnterFrame = function() {
... and with all the other script (that makes him move, shoot and whatever), then comes this to define the trail:
_root.trail_mc.trail_sprite._x = this._x;
_root.trail_mc.trail_sprite._y = this._y;
_root.trailbitmap.draw(_root.trail_mc);
trail_rectangle = new flash.geom.Rectangle(0, 0, 500, 350);
trail_blur = new flash.filters.BlurFilter(2, 2, 3);
_root.trailbitmap.applyFilter(_root.trai lbitmap, trail_rectangle, new Point(0, 0), trail_blur);
}
Ok, so this works perfectly. Then just just have trail_shape and trail_sprite movie clips and it works fine.
-but-
The problem is that I don't want the frame to call in (attach) the player, but I want for me to set the player (with my mouse) on the stage. And I would script the player movie clip instead of the frame (don't ask my why :P).
Now I don't know how to transfer this code, so that it works perfectly as here.
I manage something, but the trail looks ugly with huge pixels and it "lags" and moves weirdly/slowly.
I tried countless of things but can't get it to work.
Any help appreciated.
Thanks :)
Uh, sorry. I completely missed that ...
but yet 90% of the people post action script questions here :l
Thx
Can noone help me?
Heya.
I playing around with a "space-shooter" game and I have this script that goes into the first frame, to make the player (hero) appear on the stage. The script then adds a bitmap of a line/trail that goes from the player (hero) when he moves (like if its a ship, a fire/smoke path or whatever).
So this comes directly to the first frame, on the root timeline:
<pre>
_root.attachMovie("hero", "hero_on_stage", 10000,{_x:200,_y:20});
_root.attachMovie("trail_sprite", "trail_mc", 8000);
trailbitmap = new flash.display.BitmapData(500, 350, true,0x000000);
_root.createEmptyMovieClip("trail", 1);
trail.attachBitmap(trailbitmap, 0);
trail_mc._visible = false;
</pre>
Then it calls the hero on stage:
<pre>
hero_on_stage.onEnterFrame = function() {
</pre>
... and with all the other script (that makes him move, shoot and whatever), then comes this to define the trail:
<pre>
_root.trail_mc.trail_sprite._x = this._x;
_root.trail_mc.trail_sprite._y = this._y;
_root.trailbitmap.draw(_root.trail_mc);
trail_rectangle = new flash.geom.Rectangle(0, 0, 500, 350);
trail_blur = new flash.filters.BlurFilter(2, 2, 3);
_root.trailbitmap.applyFilter(_root.trai lbitmap, trail_rectangle, new Point(0, 0), trail_blur);
}
</pre>
Ok, so this works perfectly. Then just just have trail_shape and trail_sprite movie clips and it works fine.
-but-
The problem is that I don't want the frame to call in (attach) the player, but I want for me to set the player (with my mouse) on the stage. And I would script the player movie clip instead of the frame (don't ask my why :P).
Now I don't know how to transfer this code, so that it works perfectly as here.
I manage something, but the trail looks ugly with huge pixels and it "lags" and moves weirdly/slowly.
I tried countless of things but can't get it to work.
Any help appreciated.
Thanks :)
Ah, and I forgot another thing.
How to add "ceiling". As this scripts makes you have three walls. Down wall (where you stand) and left and right walls to detect collision. But there is no "up wall" or "ceiling", so the character can jump through all the grounds up (doesn't bump into the ceiling), which (I think) is the reason why he doesn't want to stand on moving grounds (or is there other reason)?
Thanks :D
Hello everyone.
I'm gonna say this first, cause I'll get flamed probably:
Yes, I know I should make my own script, but I'm still a complete beginning so I use other ppl's script to learn from them.
Now, off to the problem. As I already sad I have lesser knowledge of scripting (and yes I'm learning the basics through all the tutorials), but now I stumbled upon this great script by Nathan Stockton:
onClipEvent (load) {
jumping = false;
// jumping is true
speed = 0;
// speed is 0
//////////////////////
////Ammendment 1//
//////////////////
healthX = _root.health._x;
//sets healthX to the starting X postition of the "health" MC
scoreX = _root.score._x;
//sets scoreX to the starting X postition of the "score" MC
Xpos = this._x;
//sets Xpos to the starting X postition of this MC
Ypos = this._y;
//sets Ypos to the starting Y postition of this MC
////////////////
///////
maxmove = 15;
// maxmove is fifteen(max run seed)
_root.maxshoottime = 100;
// _root.maxshoottime is set to 100
// this is how far you want the bullets to travel before deleting
}
onClipEvent (enterFrame) {
//////////////////////
////Ammendment 2//
//////////////////
_x = Xpos-_root._x;
//sets the X pos to the starting X postition of this MC
_root.score._x = scoreX-_root._x;
//sets the scire MCs X pos to its starting point on the screen
_root.health._x = healthX-_root._x;
//sets the health MCs X pos to its starting point on the screen
if (!_root.ground.hitTest(this._x, this._y, true) && !jumping) {
// if NOT hitting X and Y postion with the ground and NOT jumping
this._y += 6;
// Y positon moves up 6
}
////////////////
///////
if (!_root.shooting) {
// if _root.shooting is false
_root.timer = 0;
// _root.timer is set to 0
_root.mvsp = _xscale/20;
// _root.mvsp is set to the chars xscale divided by 20
// the answer to this is the speed of the bullets
}
if (_root.dead) {
// if dead is true
this.gotoAndStop("dead");
// goto and stop on the "dead" frame
} else {
// otherwise (if they are not dead)
speed *= .85;
// speed is multiplied by .85
// the lower the faster is slows
if (dir == "right" && !_root.leftblock.hitTest(this._x+20, this._y, true)) {
_root.health._x += speed;
// moves the health, the opposite way to the _root
_root.score._x += speed;
// moves the score, the opposite way to the _root
this._x += speed;
// moves the char, the opposite way to the _root
_root._x -= speed;
// moves the _root
}
//////////////////////
////Ammendment 3//
//////////////////
if (speed>0) {
//if speed is smaller than 0
dir = "right";
// the variable dir is set to right
} else if (speed<0) {
//if speed is greater than 0
dir = "left";
// the var dir is set to left
}
if (dir == "left" && !_root.rightblock.hitTest(this._x-20, this._y, true)) {
_root.health._x += speed;
// moves the health, the opposite way to the _root
_root.score._x += speed;
// moves the score, the opposite way to the _root
this._x += speed;
// moves the char, the opposite way to the _root
_root._x -= speed;
// moves the _root
}
if (Key.isDown(Key.LEFT)) {
// if left is pressed
if (speed>-maxmove) {
// if the speed is greater than neg. maxmove
speed--;
// speed goes lower
}
this.gotoAndStop("run");
// goto and stop the run frame
this._xscale = -100;
// scale is set to neg. 100
// this is what rotates ur char
///////////////////
///////////////
} else if (Key.isDown(Key.RIGHT)) {
// otherwise if right is pressed
if (speed<maxmove) {
// if the speed is smaller than maxmove
speed++;
// speed goes up
}
this._xscale = 100;
// scale is set to 100
// this is what rotates ur char
this.gotoAndStop("run");
// goto and stop the run frame
} else if (Key.isDown(Key.CONTROL)) {
// otherwise if control is pressed
this.gotoAndStop("attack");
// goto and stop the attack frame
attacking = true;
// attacking is true
speed = 0;
// speed is set to 0
} else if (Key.isDown(Key.SPACE)) {
// otherwise if space is pressed
if (_root.gotgun == true && !_root.shooting) {
// if _root.gotgun is true(they have the gun) and _root.shooting is false
_root.attachMovie("bullet", "bulleter", 1, {_x:_root.char._x, _y:_root.char._y-25});
// attach the movie with the Linkage name "bullet" to the _root at the character X position and the Y position minus 25
_root.shooting = true;
// _root.shooting is set true
with (_root.bulleter) {
// all code below this code and it's closer refer to _root.bulleter
onEnterFrame = function () {
// setting the onEnterFrame events (onClipEvent)
if (_root.timer>_root.maxshoottime) {
// if _root.timer is smaller than _root.maxshoottime
_root.shooting = false;
// shooting is false
unloadMovie(this);
// this movie clip is unloaded
}
_root.timer++;
// _root.timer goes up 1
_x += _root.mvsp;
// the X goes up _root.mvsp (which is set constantly and stays the same when shooting.) };
};
}
attacking = true;
// attacking is true
speed = 0;
// speed is set to 0
this.gotoAndStop("shoot");
// goto and stop on the shoot frame
}
} else if (speed<1 && speed>-1 && !attacking) {
// if speed is smaller than one and greater than neg. 1
speed = 0;
// speed is set to 0
this.gotoAndStop("idle");
// gotoAndStop the idle frame
}
if (Key.isDown(Key.UP) && !jumping) {
// if up is pressed and NOT jumping
jumping = true;
// jumping is set true
}
if (jumping) {
// if jumping is true
this.gotoAndStop("jump");
this._y -= jump;
// Y position is set down jump
jump -= .5;
// jump is set down .5
if (jump<0) {
// if jump is smaller than 0
falling = true;
// falling is true
}
if (jump<-15) {
// if jump is smaller than neg. 5
jump = -15;
// jump is set to neg 5
// capping fall speeds prevents falling through grounds
}
}
if (_root.ground.hitTest(this._x, this._y, true) && falling) {
// if hitting X an Y postions with the ground and falling
jump = 9;
// jump is set to 9
jumping = false;
// jumping is false
falling = false;
// falling is false
}
}
}
onClipEvent (keyUp) {
// on Key Up
if (Key.getCode() == Key.CONTROL) {
// if the release is control
attacking = false;
// attacking is false
}
}
This is the code for a platformer, which is by all scripts I stumbled upon the best.
The only problem all this scripts lack is the "smooth walking on slopes". They all either get stuck, walk weirdly and incorrect or go past the wall/slope and get thrown in the air or something like that.
So what I'm asking is if anyone could help me out with this problem? Anything really, I would appreciate it.
Thanks a lot in advance! :)
~Klemzo
Hey,
I'm rather new to flash and I want to make a simple platformer where it wouldn't be much of an gameplay but rather adventuring and art.
So I got a basic script from this tutorial:
-
-Platform Tutorial- by FeindishDemonClick to view.
- Type
- Game
- Rated
- Everyone
Now I would want to add some stuff:
- script to kill (like spikes or lava)
That would just make you die and put you in dead stance and like throw you to a frame or add something to screen telling you that you died and then you would have a restard button that throws you back to the beginning of level.
- lifes
to make that even more complicated, stuff that hurt you lifes, I don't know like fire or stuff like that
I had life then a script that when you touch something it decreases your lifes, but that meant if it was set to decrease 1 life it decreased 100 in just a second (there was no "cooldown" between you being hurt")
- ducking
Like something basic I could add that makes you duck when you press down.
- Kind an off topic question. How can I scretch the screen to infinity? I mean, I keep drawing something and the screen keeps streching, but then comes the limit and I can't strech on no more. So that means the levels for platformer are very short. How do platformers make levels so long without adding "rooms" and they just keep going and going? Do they make everything really small (like they draw on 1000% zoom all the time), or what?
Thanks a lot in advance! :)
I messaged you both, guys. Hope I get reply soon.
Thx~ :)
GOD I LOVE IT!
When I hear Scotland War Music I just go crazy! This is one of my favorite war musics and all those AMAZING, AMAZING, AMAZING bagpipes!! GOD ITS THE BEST! :D
Sorry for all this excitement but I'm making a game, a war game, a game that would go just perfectly with a war music and as I love Scotland war music with bagpipes of course (else its not Scotland :P) I need one! :D The ones you can hear in films when 2 armies go to "clash"! WAAGH! its awesome! :D
The only problem is I can't find it anywhere! I can't believe there are no such music to be found! I googled for almost 2.5 hours just to found it and nothing! I found bunch of music searching engines and nothing! I found bunch of "Scotland war musics" (at least the title sad so) but they were all so slow, peaceful and with no bagpipes!
So does anyone know any!? Whole collection maybe?!
This music so perfect and I must listen to it! :D
Thanks! :)
So no one can help? :P
Thx
At 7/17/09 05:48 AM, 4urentertainment wrote: You mean like this for example?
http://spamtheweb.com/ul/upload/170709/4 6046_4urentertainment.php
Yes like this.
At 7/17/09 02:25 PM, Duchednier wrote: just rapidfire press F6 and each time you do draw a little more.
Yeah I know that. But I'm interested in other ways and in masking.
Thx
At 7/16/09 12:45 PM, caseymacneil wrote: look for a tutorial on masking.
Er... that doesn't help alot.
I did find some shit but it isn't that helpful on this "like drawing" animation... :(
Anything else?
Hey guys.
I dunno how to put this but do you know animation that look like they are being drawn? Like someone is drawing them? Like if I would draw a line; like my name and in animation you would saw that (except maybe with no pencils).
So I'm wondering how do you do this? I always went and draw a little line every frame. That can take pretty long, specially if you correct it to be straight (cause in flash lines always smooth (smoothing).
So I'm wondering that I maybe don't know of an way to do this, or there is some kind of tweening...
So, any tips and help really appreciated. =)
Thanks~
lol, If you ask me you are all great... atleast compared to my skills :)
Anyhow blackattackbitch here is my msn: klemzo007@hotmail.com
I would really like to talk to you about some musics that I need them for my game.
So please add me and we can talk :)
Thanks~

