-
moving diagnal and making the mc turn that way
ok half works half dosnt when you pres up then right he looks up but moves up right but if you press right then up he looks up right and moves up right same with the left http://gioakjoe.tk/game.htm
Code:
//move
onClipEvent (enterFrame) {
if (Key.isDown(Key.Up)) {
if (Key.isDown(Key.Right)) {
setProperty("", _rotation, 130);
} else if (Key.isDown(Key.Up)) {
setProperty("", _rotation, 90);
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.Down)) {
if (Key.isDown(Key.LEFT)) {
setProperty("", _rotation, 130);
}
if (Key.isDown(Key.RIGHT)) {
setProperty("", _rotation, 230);
} else if (Key.isDown(Key.Down)) {
setProperty("", _rotation, 270);
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.Left)) {
if (Key.isDown(Key.UP)) {
setProperty("", _rotation, 55);
}
if (Key.isDown(Key.DOWN)) {
setProperty("", _rotation, 300);
} else if (Key.isDown(Key.LEFT)) {
setProperty("", _rotation, 360);
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.Right)) {
if (Key.isDown(Key.Up)) {
setProperty("", _rotation, 130);
}
if (Key.isDown(Key.Down)) {
setProperty("", _rotation, 230);
} else if (Key.isDown(Key.Right)) {
setProperty("", _rotation, 180);
}
}
}
Last edited by gioakjoe; 10-28-2004 at 09:39 PM.
its my mech game 4050 still in the work pm if you have any coments about it
im tring to make lock on missiles if you have any ideas pm me
-
n00b
solution:
Eat this and stop writing such nasty code! Only one load and one enterFrame clip event per clip needed!! Thats what the brackets are for.
code:
//move
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP) && Key.isDown(Key.RIGHT)) {
setProperty("", _rotation, 130);
} else if (Key.isDown(Key.UP) && Key.isDown(Key.LEFT)) {
setProperty("", _rotation, 45);
} else if (Key.isDown(Key.UP)) {
setProperty("", _rotation, 90);
} else if (Key.isDown(Key.DOWN) && Key.isDown(Key.LEFT)) {
setProperty("", _rotation, 130);
} else if (Key.isDown(Key.DOWN) && Key.isDown(Key.RIGHT)) {
setProperty("", _rotation, 230);
} else if (Key.isDown(Key.DOWN)) {
setProperty("", _rotation, 270);
} else if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
setProperty("", _rotation, 130);
} else if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
setProperty("", _rotation, 130);
} else if (Key.isDown(Key.RIGHT)) {
setProperty("", _rotation, 180);
} else if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
setProperty("", _rotation, 300);
} else if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
setProperty("", _rotation, 45);
} else if (Key.isDown(Key.LEFT)) {
setProperty("", _rotation, 360);
}
}
I do stuff that does stuff...
J-Force
-
(F)FlickCorp. Productions
Re: solution:
Originally posted by LeechmasterB
Eat this and stop writing such nasty code! Only one load and one enterFrame clip event per clip needed!! Thats what the brackets are for.
you leech nice comment u know he prob just like learning like lots of people you probably made the same mistakes once before take it easy the prob with AS is there are somany variaions of one code...
-
(F)FlickCorp. Productions
my opnion is
my opnion is if the code works then thats great u worry about the little things until its done then you can change later
-
Say hello to Bob
i know your just learning yourself ingage and to learn you need people like leech to aid you, thats all leech was doing, he pointed out the mistakes that were made so that they would not be made again.
also what joe did is not a variation of code, it is wrong, it is messy and it also makes the engine run slower, also doing a game and then having to change everthing because it is not running very quickly is not good coding practice,on a final note it is better to learn good coding now so that you have a solid base to learn from.
whod like a dohnut
If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?
-
hey guys thanx for the advise this is my first flash game and im learning some thing new ever day i will go back and clean my code up
it runs slow the bigger you have the window http://gioakjoe.tk/game.htm that will make the game play at a good speed and how it should look thanz and i would liek a
that code worked almost perfect idk but the down left angle isint right and even if i change it it dosnt change it ill play with it
i took out all those opean clips like ya said and it dose run faster now all i need to do is figure out how to make him stop when he hits a object or the yello bar around the map
Last edited by gioakjoe; 10-28-2004 at 09:34 PM.
its my mech game 4050 still in the work pm if you have any coments about it
im tring to make lock on missiles if you have any ideas pm me
-
n00b
yeah
The cleaner you program the easier it is to find bug and change and add things. If you d use classes it would be the best way .
Open a new .as file and write "class", highlight it press f1 and read for more details.
The game has gotten much better
Just found a bug: when you press down and left its the wrong angle... (the angle for up and right ;o).
If you want a faster scrolling terrain, this might interest you aswell:
http://www.flashdev.ch.vu/gta-flash/editor.html
Last edited by LeechmasterB; 10-28-2004 at 09:41 PM.
I do stuff that does stuff...
J-Force
-
cheeck it out i cleaned it out alot and added a lil mini map and fixed alot of things like if you walk off the map but i still have alot more to do. haha i really like the mini map i put caz you can turn it off and on with "m" turns it off and "n" turns it on. but the big prob is that the life wont go in my text box on the bottem right and the points for eatch building to tell you that you when when every thign is gone dosnt work so yea i got some ways to go but im learning sooo much
http://gioakjoe.tk/game.htm
its my mech game 4050 still in the work pm if you have any coments about it
im tring to make lock on missiles if you have any ideas pm me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|