Create a flash draw game like Line Rider or others - part 5
Filed Under Flash •
Finally this tut has its 5th part.
You should read steps 1 to 4 before continuing with this one, although this time it's not so important, because before to approach the "running car" I am going to explain the "walking man" on a line.
The same kind of gamestyle you can find in draw play 1 and 2.
Believe or not, this is an important step to understand before adventuring into running cars.
Now, let's start.
I said we are going to see a man walking on a line we created.
As usual the "line" is instanced as terrain while the code I am showing is the one in the "player" object... yes, that red box is supposed to be the player...
The player is falling
The first thing to do is determine when the player is falling and when the player isn't falling. If you think about the real world, a man is falling when there is no ground under his feet. Or when he's so drunk. Or both. But at the moment we are only interested about the ground.
So, let's translate real world physics into actionscript:
-
onClipEvent (load) {
-
gravity = 0.2;
-
yspeed = 0;
-
}
-
onClipEvent (enterFrame) {
-
if (_root.go) {
-
yspeed += gravity;
-
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
-
_y--;
-
yspeed = 0;
-
}
-
_y += yspeed;
-
}
-
}
Line 2: Set the gravity at 0.2
Line 3: Set the yspeed (vertical speed) to zero
Line 6: Checks if _root.go is true. This is true once the "go" button is pressed. It's not important for the game, I put it just to make the movie wait for a user input before starting.
Line 7: Gravity calls... yspeed is increased by gravity value.
Line 8: Performing a hit test between the terrain and the _x, _y+_height/2 spot. Since the anchor point of the player is on its center, you can easily understand the spot is located in the middle on the bottom side. Basically, the player's feet.
Line 9: raising the player of one pixel (obviously, since the player must be sunk at the moment)
Line 10: set yspeed to zero (no need to fall if we are sunk into the ground)
Line 12: add yspeed to _y position
Look at the movie:
The player is not stable to the ground. Maybe the floor is too hot, maybe the code has something to be fixed.
The problem is that once the player touches the ground, I continue adding yspeed to _y position, so the player sinks a bit into the ground. Then, the while loop raises him a bit, just to watch him sinking again. That's why the player seems to flick.
The player is falling - part 2
I need a hack to tell the "physics engine" to stop considering yspeed if the player has its feet on the ground
-
onClipEvent (load) {
-
gravity = 0.2;
-
yspeed = 0;
-
}
-
onClipEvent (enterFrame) {
-
if (_root.go) {
-
yspeed += gravity;
-
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
-
_y--;
-
yspeed = 0;
-
}
-
if (!_root.terrain.hitTest(_x, _y+_height/2+1, true)) {
-
_y += yspeed;
-
} else {
-
yspeed = 0;
-
}
-
}
-
}
Lines 12-13: The yspeed value is added to _y (old line 12) only if the player is in the air. Look at the +1 in the _y+_height/2+1. I need to "forecast" next player's position and if I find it will be in the ground, then I stop considering the gravity. Otherwise lines 14-15 set yspeed to zero.
Now the player is falling in the right way.
Let's make him walk now.
The player is moving
To make the player move, we need to check if some keys are pressed and manage the x speed according to the key pressed.
-
onClipEvent (load) {
-
gravity = 0.2;
-
yspeed = 0;
-
xspeed = 1;
-
}
-
onClipEvent (enterFrame) {
-
if (_root.go) {
-
if (Key.isDown(Key.LEFT)) {
-
_x -= xspeed;
-
}
-
if (Key.isDown(Key.RIGHT)) {
-
_x += xspeed;
-
}
-
yspeed += gravity;
-
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
-
_y--;
-
yspeed = 0;
-
}
-
if (!_root.terrain.hitTest(_x, _y+_height/2+1, true)) {
-
_y += yspeed;
-
} else {
-
yspeed = 0;
-
}
-
}
-
}
Line 3: Set x speed to 1
Lines 8-10: If the left key is pressed, I move the player xspeed pixels to the left
Lines 11-13: Same thing with the right arrow key
Now the player can walk!!
But... try to walk to the left margin of the stage... or to the right one... you may notice there is a hard slope, but the player walks on it as if it was a plain ground. That's not realistic!!
The player is moving - part 2
In order to make the player stop walking when on a too hard slope, we have to define a "knee" point. If the "knee" hits the ground, it means the ground is a hard slope, or a stair, o whatever thing the player can't climb.
-
onClipEvent (load) {
-
gravity = 0.2;
-
yspeed = 0;
-
xspeed = 1;
-
}
-
onClipEvent (enterFrame) {
-
if (_root.go) {
-
if (Key.isDown(Key.LEFT)) {
-
if (!_root.terrain.hitTest(_x-_width/2, _y+_height/4, true)) {
-
_x -= xspeed;
-
}
-
}
-
if (Key.isDown(Key.RIGHT)) {
-
if (!_root.terrain.hitTest(_x+_width/2, _y+_height/4, true)) {
-
_x += xspeed;
-
}
-
}
-
yspeed += gravity;
-
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
-
_y--;
-
yspeed = 0;
-
}
-
if (!_root.terrain.hitTest(_x, _y+_height/2+1, true)) {
-
_y += yspeed;
-
} else {
-
yspeed = 0;
-
}
-
}
-
}
Line 9: Before moving the player to the left, I assure his "knee" (located to the leftmost side of the square at a quarter height of the player) is not touching the ground.
Line 14: Same thing with the right side.
Now the player cant' walk on slopes!! Now we want the player to jump
The player is jumping
To make the player jump, I am going to check if the SPACE key is pressed
-
onClipEvent (load) {
-
gravity = 0.2;
-
yspeed = 0;
-
xspeed = 1;
-
}
-
onClipEvent (enterFrame) {
-
if (_root.go) {
-
if (Key.isDown(Key.LEFT)) {
-
if (!_root.terrain.hitTest(_x-_width/2, _y+_height/4, true)) {
-
_x -= xspeed;
-
}
-
}
-
if (Key.isDown(Key.RIGHT)) {
-
if (!_root.terrain.hitTest(_x+_width/2, _y+_height/4, true)) {
-
_x += xspeed;
-
}
-
}
-
if (Key.isDown(Key.SPACE)) {
-
yspeed = -5;
-
}
-
yspeed += gravity;
-
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
-
_y--;
-
yspeed = 0;
-
}
-
if ((!_root.terrain.hitTest(_x, _y+_height/2+1, true)) or (yspeed<0)) {
-
_y += yspeed;
-
} else {
-
yspeed = 0;
-
}
-
}
-
}
Lines 18-20: If the SPACE key is pressed, the yspeed is set to -5 (since yspeed is affected by gravity, a negative value will make the player fly).
Line 26: In the if statement I add a check: If the yspeed is less than zero (player jumping) I add the yspeed to _y even if the player is not going to touch the ground. Without that condition, the player will never jump.
Look at our jumping player!
Again, it's not over... as you can see, if you press SPACE while the player is in the air, the player will jump again, and again... you can make the player fly and I don't want it.
The player is jumping - part 2
I need a variable to decide if the player can jump or not. Basically, a player can always jump execpt when he is already jumping
-
onClipEvent (load) {
-
gravity = 0.2;
-
yspeed = 0;
-
xspeed = 1;
-
jumping = 0;
-
}
-
onClipEvent (enterFrame) {
-
if (_root.go) {
-
if (Key.isDown(Key.LEFT)) {
-
if (!_root.terrain.hitTest(_x-_width/2, _y+_height/4, true)) {
-
_x -= xspeed;
-
}
-
}
-
if (Key.isDown(Key.RIGHT)) {
-
if (!_root.terrain.hitTest(_x+_width/2, _y+_height/4, true)) {
-
_x += xspeed;
-
}
-
}
-
if ((Key.isDown(Key.SPACE)) and (!jumping)) {
-
yspeed = -5;
-
jumping = 1;
-
}
-
yspeed += gravity;
-
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
-
_y--;
-
yspeed = 0;
-
jumping = 0;
-
}
-
if ((!_root.terrain.hitTest(_x, _y+_height/2+1, true)) or (yspeed<0)) {
-
_y += yspeed;
-
} else {
-
yspeed = 0;
-
jumping = 0;
-
}
-
}
-
}
Line 5: initializing a variable to tell the player is not jumping
Line 19: Added the control if the player is NOT jumping when SPACE key is pressed.
Line 21: Set the jumping variable to 1. Actually, the player is jumping (so he can't jump anymore until he touches the ground)
Lines 27 and 33: Set the jumping variable to zero. When the player is hitting the terrain, or when the player is about to hit the terrain, he is not jumping, or the jump is over.
There are some other things to fix but at the moment it's over.
Download the full source codes and give me feedback
Other Links: casino game
Tell me what do you think about this post. I'll write better and better entries.
They can be easily customized to meet the unique requirements of your project.
96 Responses to “Create a flash draw game like Line Rider or others - part 5”
Leave a Reply
Trackbacks
-
Create a flash draw game like Line Rider or others - part 1 at Emanuele Feronato on
March 31st, 2007 12:13 am
[...] March 31st update: part 5 released March 4th update: part 4 released February 17th update: part 3 released February 3rd update: part 2 released [...]
-
Create a flash draw game like Line Rider or others - part 2 at Emanuele Feronato on
March 31st, 2007 12:14 am
[...] March 31st update: part 5 released March 4th update: part 4 released February 17th update: part 3 released [...]
-
Create a flash draw game like Line Rider or others - part 3 at Emanuele Feronato on
March 31st, 2007 12:14 am
[...] March 31st update: part 5 released March 4th update: part 4 released [...]
-
Create a flash draw game like Line Rider or others - part 4 at Emanuele Feronato on
March 31st, 2007 12:15 am
[...] March 31st update: part 5 released [...]
-
Create a flash artillery game - step 2 at Emanuele Feronato on
May 25th, 2007 5:30 pm
[...] Line 57: Init enemy yspeed at zero. It’s obvious that I won’t move the enemy with a motion guide but with pure actionscript, just in case tomorrow I would like to change the terrain. I am using some of the basics explained in the tutorial called Create a flash draw game like Line Rider or others - part 5 so give it a look if you haven’t done it yet. [...]


(10 votes, average: 3.6 out of 5)
NICE JOB
A
Thank you so much!
Your tutorials are some of the best on the net…
This Line Rider game is something I’ve been wanting to build since I started with Flash…
Your Actionscript explanations are thourogh and clear; and the game I made with parts one through four has been played for hours by both my sisters… I usually create an obstacle course, and let my sisters find their way around it…
One thing I’m trying to learn to do is influence the “ball” with the arrow keys. I’ve managed to add a “reset ball” button which resets the ball and allows you to add terrain. A “line erasing” tutorial would be great also…
Keep up the great work and simple tutorials!
-Alec
Oh… Wow! I did this tutorial and input
if (Key.isDown(Key.RIGHT)) {
_x = xspeed;
into the ball code; right after the collision code for the first tutorials… Now, by pressing the up key while close to the ground, the ball flies far higher than before. This is useful for annoying spots where the ball is stuck behind a wall or in a crevice…
very cool.
Thanks man. i made a sweet game because the tutoirals you have explain everything clearly.
can you add a part 6 and make an erase button to delete some lines without eraseing them all?
cool
:)
Woops. almoast forgot.
i made a “free play” part in thr game other than the levels.
can you tell me the code to move theexit with the arrow keys.
i copied the code for movement from my “hero” game (one of the tut’s u poasted very cool) but it dosent work.
HELP ME lol
:)
which version of flash player is required to develop this
Awesome tute!
In your next one I would really love to see how to make the car/ rectangle rotate so both wheels would be on line.
excellent!!
can’t wait for next!!
Excellent however im using your coding but I’m still seeming to get the bobbing action in certain areas?
I have a question for anyone who reads this… Thanks in advance…
How would I code the exit point to take the playhead to the next frame? I would really like to know this because then I can have levels. I’ve seriously tried everything, but even without the “stop code” the ball freezes on the exit point.
in reply for alec:
its simple, copy the below code for ball
onClipEvent(enterFrame) {
if (_root.exit.hitTest(_x, _y, true)) {
_root.gotoAndPlay(FRAMENUMBER)
}
replace FRAMENUMBER by the frame you want to go.
I’m not sure it will work but still you can try.
george: make a button in the exit mc with this action script:
on (press) {
drag = true;
}
on (release) {
drag = false;
}
and on the exit mc put this code:
onClipEvent (load) {
drag = false;
}
onClipEvent (enterFrame) {
if (drag == true) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
}
That’s so cooool
You’re really good at it
I’d like to be as fantastic as you are :D
I also have MFP 8 I’ve just downloaded it and like now I don’t know what to do with it ^^ I’m learing how to use it :D
I used Adobephotoshop before…
.Cheers
abhalisha i enterd the action script an**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 17: ‘else’ encountered without matching ‘if’
} else {
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 74: Unexpected ‘}’ encountered
}
**Error** Scene=Scene 1, layer=Layer 2, frame=2:Line 17: ‘else’ encountered without matching ‘if’
} else {
Total ActionScript Errors: 3 Reported Errors: 3
d it didnt work it said
i was wanting to make a game sorta diffrent to this were u can move but without gravity as if your looking for a birds eye view.
you can move all derections but cant go through lines. sort of like whats happening here but i dont know how to do it could you help me?
it a bit hard to explain lol soz if this makes no sense :S
hey iam kinda mad at you because you kinda coppyed my code but o well. my code:
onClipEvent (load) {
j = 0;
c = 1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
if (c > 0) {
j = -6;
this._y -= 6;
c = 0;
}
}
}
onClipEvent (enterFrame) {
if (j > 3) {
j = 3;
}
}
onClipEvent (enterFrame) {
if(_root.ground.hitTest(_x (_width/2),_y,true)){
_root.ground._x = 10;
}
if(_root.ground.hitTest(_x-(_width/2),_y,true)){
_root.ground._x -= 10;
}
if(_root.ground.hitTest(_x,_y (_height/2),true)){
_y -= 3;
j = 0;
c = 1;
}else{
j = 1;
this._y = j;
}
if(_root.ground.hitTest(_x,_y-(_height/2),true)){
j = 3;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.ground._x -= 6;
_xscale = 100;
_root.guy.gotoAndStop(2);
}else if (Key.isDown(Key.LEFT)) {
_root.ground._x = 6;
_xscale = -100;
_root.guy.gotoAndStop(2);
}else{
_root.guy.gotoAndStop(1);
}
}
can you try to make it so when he goes up a hill he tilts like in fancy pants advinture
plz reply
i used youre code with my code to make
onClipEvent (load) {
j = 0;
c = 1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
if (c > 0) {
j = -6;
this._y -= 6;
c = 0;
}
}
}
onClipEvent (enterFrame) {
if (j > 3) {
j = 3;
}
}
onClipEvent (enterFrame) {
if(_root.ground.hitTest(_x (_width/2),_y,true)){
_root.ground._x = 5;
}
if(_root.ground.hitTest(_x-(_width/2),_y,true)){
_root.ground._x -= 5;
}
while(_root.ground.hitTest(_x,_y (_height/2),true)){
_y–;
j = 0;
c = 1;
}
if(!_root.ground.hitTest(_x,_y (_height/2),true)){
j = 1;
_y = j;
}
if(_root.ground.hitTest(_x,_y-(_height/2),true)){
j = 3;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.ground._x -= 5;
_xscale = 100;
_root.guy.gotoAndStop(2);
}else if (Key.isDown(Key.LEFT)) {
_root.ground._x = 5;
_xscale = -100;
_root.guy.gotoAndStop(2);
}else{
_root.guy.gotoAndStop(1);
}
}
are u making a next part or is this the last?
It’s not the last… a lot more will come.
help meee..lol…i got lost on the very first step :( .Im not that experienced.
THANK YOU !!!!
I want to tell u how useful are your tutorials.
I start to learn actionscript with them and I have beem trying to complete the develop of a game like line rider since some weeks ago.
After try to write the script for collisions using the hitTest in all the ways I have found a better method in a flash called attractors.
I´m next to coplete the game. Here I write the links for “attractos” and for my “line cross rider” preview.
http://www.thecleverest.com/content/attractors.swf
http://denvish.net/ulf/180407/4978_Line_Cross _Rider_beta4.php
Hey, Love your tutorials. But i was wondering, are you going to do a tutorial on how to make a game like the one on this page? http://www.playgamesclub.com/online-games/puzzles–brain-online-games/free-rider.html
Thanks for your work so far and I’ll be waiting for a reply.
I think it’s simpler than LR.
A good idea for an intermediate step, I’ll try to do something like this.
Ok, thanks very much. BTW, is there any way to use the script you have provided, along with the drawing script, to make a basic game like the draw play? because i’ve been trying and it’s not really working… I’m really not the best at Actionscript.
And, if you dont mind me asking, when do you think you’ll have your next tutorial out?
Hi, I’m new to actionscript, and I was wondering if you could publish a script to tell me how, that if you press space when you’re already in the air, it makes no difference, you start descending after hitting the space bar once.
oops, sorry, you already do it
could you do something for a scrolling screen please?
Please can you make a tutorial on how to make a game like adventure quest
Hi Emanuele.
You’re great at Code(and you’ve got the biggest patience I’ve ever seen too).
I was wondering, how do you estabilish the player’s position
over the platforms, after he jumps from beneath one of them?
I saw lots of people doing this, and lots of mistakes as a result. Do you simply estabilish a fixed position one some part of the square
Hi Emanuele.
You’re great at Code(and you’ve got the biggest patience I’ve ever seen too).
I was wondering, how do you estabilish the player’s position
over the platforms, after he jumps from beneath one of them?
I saw lots of people doing this, and lots of mistakes as a result. Do you simply estabilish a fixed position one some part of the square
Um…when can we expect part 6? i’ve been waiting for quite a long time and would love to know how to continue making the game.
That would be nice. If he does make another, my guess would be it would be near the end of june.
Yah, will there be a part six? Are you making one? Please post a reply for us.
Sure, I am working on it
Emanuele your the best, now I can program really well because
of your tutorials. I’m kinda knew to actionscript.
What dose this operator do?” while () {} “
hi, ur great.
i wondered if in the next part you will be including screen follow.
please do.
cud someone show me how to go back to the start point on collision with, for example, spikes? creatin a platform game
Hi
crawfy, you wanted to know how to restart a players position, here:
_root.spike.hitTest(_x, _y, true){
_x = 5
_y = 5
}
or for the hitTest you can use this:
_root.spike.hitTest(this){}
Very cool tutorial,
what dose this code mean though? :
while () {}
thanks in advance :)
How do you make the square adjacent to the line? the bottom of the square says flash and does not go flat with the line? can you tell me?
how could i remove the line after i drew it?
your tutorials are the best, I come to this site all the time to see when part 6 is done.
Adventure quest can’t be made purely with flash doom boy, you need to set up and server and create a few php scripts and some databases. which take lots of money.
thanks art
line rider 1.
I am trying to reach you about business opportunities
iam seen your tutorials it is very nice but now iam in learning stage. Will you please give me some simple and best examples which I can understand easily thankyou
Yay i cant believe it worked
http://img66.imageshack.us/my.php?image=finalgameat8.swf
Hi
Just found your tutorial and it’s awsome, thank you! When does tutorial number 6 come? I’d love to see another part of this great tutorial…
Good and clear tut.
But it made me wonder how far that “nice red block” actually can jump!!
you can try it out yourself: :P
http://redox.awardspace.com/sports/pituushyppy.html
Same keys as in this tutorial..just jump on to red line..and..oh well,that was it.
(yep,I was bored…)
10.323
hi
very nic tut man
can u explain how to make guns and all
like a movieclip gun which has a bullet movieclip or something. PLS.
with limited ammunation and special effects while shooting like black smoke or sparks or somethin like that.
hi emanuele,
pls explain how to create a game like mortal kombat in which 2 guys fight (player 1 and player 2) using diff powers. And some powers can only b used when there is a graph full or something.
ALSO
explain how to make a graph which indicates score or life instead of dynamic textboxes.
i dont get it at all
Hi! I am making a game for commercial purposes, and I was wondering if these action scripts for the flash draw game are copyrighted, or are they free to use for my game. If I could use them, I would be happy to site this website in the game, if you want. thanks!
Feel free to use the script as you want, thank you for giving me a credit, once completed send me the game and I’ll publish on my site.
i’ve been waiting for part 6 for almost half a year, do you know when it will be done? thanks
Thank’s
I’m just starting with flash and i really have to admit that you’re tutorials are the clearest and most explained i could find on the net.
I DOWNLOADED YOUR “FULL SOURCE CODES” AND THEY CRASHED FLASH!!!!!
ok….why the hell when i click download all sources i get all the pictures ive ever seen on the internet,all my friends bebo/myspace pics,i have got MILLIONS i want a fucking good explanation cuz i am pissed off.i want to know how u got all of my m8s pics aswell onto my laptop.REPLY.
I think it’s something on your computer.
I’ve been making a platformer where I can just draw a terrain with the paintbrush tool and my character (currently a square) will be able to walk and climb around on it. Hopeuffly, these tutorials might help me program working slopes. Right now they work… sort of. I’ll try to get some better guidance from your codes. Which are totally awesome, by the way.
Very nice man. Except one thing….. if you don’t jump but instead WALK off the platform, you can still jump… midair. Very well explained… thx.
hey cory, that’s not hard to solve.
in my game i’ve added a “collision” boolean.
whenever gravity is applied, collision goes false, when it’s not it goes true.
so if you go off a platform, the boolean will go false, and you won’t be able to jump, since in my game the jumping code is like this:
if (Key.isDown(Key.SPACE)&& collision==true)
I was just saying… besides, there’s a FAR easier way.
onClipEvent(enterFrame){
if(yspeed>0.1 or yspeed<-0.1){
jumping2=1;
}else{
jumping2=0;
}
if(Key.isDown(Key.SPACE) and jumping2==0){
yspeed=-4;
}
}
Emanuele, you should add that to the tutorial. Also, you should change the gravity to make it larger and the jump speed to make it like -6, so that it remains the same jump height, but it makes it so that the player gets less jump time, making it look more realistic.
Art Said: Very cool tutorial,
what dose this code mean though? :
while () {}
thanks in advance :)
that command is like the *for* instance, but instead of manipulating a variable, it just does it until the condition isn’t correct anymore.
For example, in this it says:
while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
_y–;
yspeed = 0;
}
think of it like this. UNTIL that condition ISN’T right, do the action. Hope that helps.
could you make it so if the man is on the slope, he then is leaning as if he was on the slope.
if that makes sence…
Hey! I really like you’r tutorials, but I tried to add
this.gotoAndStop(2);
as in
if(Key.isDown(Key.RIGHT)){
this.gotoAndStop(2);
But that didn’t really work… Could you help me a bit? I want a animation that is on frame 2 of the “guy” movieclip to start when you hit the key right. Also you should make a key setup “tutorial” so that you can use w a s d etc.
great tutorial !!! thank u so much, it’s really help me.
When are you going to make more tutes?
Are you going to continue this? Reply please! :D
I want to see that too.
make it a button then put for the script
on(rollover){gotoAndPlay(*)}
* = the number of the frame you want to goto
but you will have to edit this so that when the block rolls over it goes to the next frame
cause the script there will make it so when the mouse rolls over it goes to the next frame adn we dont want that sry if this didnt help much cause i am still editing the code so that the blob is what needs to go ovewr it
I deleted the CreateEmptyMovieclip and made a movieclip with the terrain name & stuff, but when I draw, it draws really far away to the bottom right of the mouse. HELP PLZ???!!?!?!!!!!?!?!?!?!
Like a few others here, I’d like to know how to make the “hero” rotate naturally as it moves up hills and down hills. Like if the box was a car the “hero” would rotate.
Hi, first of all, thanks for this amazing tutorial :D
But I have one question,
I made a terrain which is bigger than the window, and I want prevent the character walks out of the window. I want the terrain also to move when the character is almost out of the window.
I dont know if my question is clear because my English is pretty bad :s
But maybe an example will help, everyone knows the supermario game I suppose…
Well, in supermario the terrain also moves, supermario is always centerred in the window.
I hope someone can help me :)
–bram–
Bram,
All you need to do is
onClipEvent (enterFrame) {
if (_root.go) {
if (Key.isDown(Key.LEFT)) {
if (!_root.terrain.hitTest(_x-_width/2, _y+_height/4, true)) {
_x -= xspeed;
//this is where you change
_root._x += xspeed;
}
}
when will the next tut be out?!
Great tutorial - my only problem is that the ball won’t stop bouncing. Does anyone have the code to stop the ball from bouncing like in real life? Many thanks if anyone is talented enough to help. :)
is there any way top print all tutorials form 1 to 5 because its hard to read all of them and do some reasearch along like if i want know what are parameters of sin in flash i am not opening flash again agian Right plus if i have papers i will be able to read anywhere and anyway so plsz reply also reply on email
My Web fire08.110mb.com
i hope this works
hi,my name is rick roberts & i am intersested in learing how to create my own video game one day & i would like to say that this is the best tutorial i have seen in a long time & i have seen alot of them i am a rookie when it comes to creating but i do understand what to do.i would like to ask if you can, can you please try to explain to me more of how to work this because i understood alot of whet you put on the tutrial but some it it just didnt make sense or it cold be because i have only been doing this stuff for like two months lol.well anyway if you can please try to help me out i would apprciate it alot thank you rick!!!
Nice I This Part Was Easy IF Compare To previous parts hey explain previous parts more
hey do you hav a code to change the lines color?i cant find 1….
im a different alec
how do you make the exit goto the next frame?
is there any chances to do this tutorial for a “online players” like.. http://www.ff0000.com/ ?
Hi.
I’d like to say that I really like this tutorial and that it would help me make my own side scrolling computer game in flash.
Unlike most platformer tutorials that only handle flat platforms, this one can be made to handle not just slopes but also oddly shaped platforms.
I used to use “if” statements for hittests but now I know “while” statements work better.
Thanks.
Hi,
I love this tutorial and its a great tool to know how to “draw” on the screen.
My question is, how do you save it now?
you mentioned in part 1 that you would tell us in part 2 how to save, but I never saw it.
Can anyone tell me how to save the drawing?
i am familiar with php/xml and the likes, but code and function wise i wouldnt know where to start
thx in advance
ummm… what are we posting these actionscript codes on.
no entendi ,si se hablar ingles, very well i need to say but, no se que es eso de actionscript el codigo donde lo pego o que hago con ese codigo lo pego en los fremas de macromedia flash o que? que hago!
erick’s translation (with Google Translator)
not understanding, if we speak English, very well but i need to say, not what do you mean, actionscript code where you hit or what I do with this code hit in the Fremen of Macromedia’s Flash or what? I do!
i wil like to make a game please
I made a game with this code, it works fine. However, I want to add a zoom, a scroll, and a change line color function (I could probably figure that one out). To give whoever responds to this an idea, I have no preset lines. I have a draggable exit, a car for the player (who can’t move himself) and a large blank background.