-
[BETA] Line Fighter
My game is just about ready to released, I'd just like it to be tested first.
You can play it here:
http://www.allgamesallfree.com/content/linefighter.html
So what is Line Fighter? Line Fighter is a flash game where you draw your own adventure game using the mouse and are able to set monsters, traps, and a flag at the end of your level. Survive all the traps and kill all the enemies in a level to win. You can save with a copy/paste level code, and even load anybody elses level.
I'd like you guys to tell me what you think, what bugs you can find, and I'd also love to see some levels you've made ;).
-
well, i like the idea alot. the implementation, not so much, for 3 reasons:
1.no erase button. also, you should disable any type of drawing while clicking any of the items in the menu, it adds unwanted traps and such.
2.the character attacks slow, and weak(and looks bad as well). since the enemy (bat in this case) isn't forced to recoil, he can attack you twice as fast as you can attack him. plus, it takes too long to reposition your character to where he will actually hit the enemy
3.the character movement on slopes needs to be improved greatly. at one point, i could jump next to a slope and go right through it because when i was "bumped up" from hitting the slope, the new position was out side of the wall
other than those 3 issues, i think its a really cool idea.
-
good idea but as squibgie90 mentioned some things do need to be fixed
-
Eraser and etc
I see your point, ive been thinking of adding an undo button for a while now but im not sure how I would implement it, an erase button would be way beyond me however. Also you're right, I need to make it so you don't get those extra drawings and unwanted traps, as for the enemy attacks and etc it could be because the game is lagging possibly ? Maybe try lowering the quality.
-
i have no experience with this type of game really, but an eraser seems like it'd be super easy. when the character draws anything, that object should be added to an array. so, when the character chooses the eraser option, some kind of small graphic would follow the mouse around and on a mouse down event, simply loop through the array of objects to see if one as hit the eraser movie clip, and if so, remove it, and splice it out of the array.
let me rephrase my comment about the enemy attacks:
once you attack the enemy, it can attack you back instantly, regardless of whether you are still attacking it.since the attacks are simple melee attacks, it is impossible to hit the enemy without getting hit yourself, therefore, no skill is needed, as you will always die after you attack an enemy so many times(if there are three enemies, and you have only 2 health units. you would not be able to complete the level if each enemy took away one health unit per attack).
2 ways you could improve that though:
a) simply cause the enemy to be "thrown back" about 10 pixels or so in the direction of the characters attack
b)change the attacks to distance attacks such as a pistol firing and teach the enemies AI to dart in towards the player to attack and then dart back away from the player after it has attacked
-
Thank you thats much easier to understand, heh don't overestimate my intelligence just because I made a complicated game ;). Anyway, an erase button I'm not quite so sure would be so simple because how would the game know exactly what curve you're hitting into when its all a single movieclip? but im certain I could remove the last array added and redraw the lines with an undo tool. Im going to test what you said about pushing the enemies back, my typical strategy is lure the enemy, hit with melee attack, run back.
-
that strategy works BUT if you get trapped in a corner, you can't jump over the enemy because he moves directly towards you at a speed faster than you can move away from it. therefor, you'd have to fight your way out, but, seeing as the enemy has no fear whatsoever of your fists, or stomach in this case i guess, he relentlessly pumels you in the same spot.
um, redrawing all the lines like that would seem a little over complicated not to mention, inefficient.
essentially, the new array would be the exact same as the first array, except it has one less movie clip in it
so if you have 1000 objects in your array, the new array would be 999 units long. so, you'd have to recreate 999 new objects, instead of just removing 1.
-
I'm not sure but I don't think its actually possible to remove lines in flash. You see, my game doesn't actually draw the lines directly from the array it uses a basic line to and the load function redraws a full array of your level. So the only way to do any sort of erasing would be to remove the unwanted thing from the array and load the new level, naturally.
-
im confused, but, obviously, your method is different from what i probably would have done, so my techniques are voided lol
-
Well heres a chunk of my brush code:
if (apples == true){
if (apples2 == true){
}
_root.menu.color= 000000;
if (apples2 == true){
terrain.lineStyle(_root.brushsize, 0x000000, 100);
}
imdrawing = false;
onMouseDown = function () {
if (imdrawing == false) {
if (apples2 == true && _root.win._currentframe == 1){
if (determined != true) {
}
}
determined = true;
imdrawing = true;
}
if (imdrawing == true ) {
if (apples2 == true){
terrain.lineStyle(_root.brushsize, 0x000000, 100);
onMouseMove = function () {
if (_root.win._currentframe == 1){
if (determined == true) {
if (Isset != true){
terrain.moveTo(_xmouse, _ymouse);
undoArr.push("."+_xmouse+",."+_ymouse);
pointXArr.push("."+_xmouse+",."+_ymouse);
Isset = true;
}
terrain.lineTo(_xmouse, _ymouse);
undoArr.push(""+_xmouse+","+_ymouse);
lineSkip += 1;
if (lineSkip == 3) {
pointx = _xmouse;
pointy = _ymouse;
lineSkip = 0;
pointXArr.push(""+pointx+","+pointy);
}
}
}
};
}
}
}
See, it draws directly from the mouse and makes it into the terrain movieclip, it also moves the lines into an array to be loaded possibly in the future. Actually removing a part of that specified with an erase tool is far beyond me, and I'm trying an undo tool with no success either -.-.
-
hmm, lot of conditionals there. little hard to understand outside of a code block too. let's see, if i was gonna draw lines like a line tool, this is probably how i'd do it:
PHP Code:
d=0
lineArray = []
startx=0
starty=0
endx=0
endy=0
function drawLine(){
//create new line
line=_root.createEmptyMovieClip("line"+d,++d)
line.lineStyle=(2,0x000000,100)
//line starts where the mouse button was pressed
line.moveTo(startx,starty)
//line ends where the mouse button was released
line.lineTo(endx,endy)
lineArray.push(line)
}
onMouseDown = function(){
startx=_xmouse
starty=_ymouse
}
onMouseUp = function(){
endx=_xmouse
endy=_ymouse
drawLine()
}
function undo(){
//little sketchy here about removing the last movie clip
//lineArray.pop() will return the last item in the array
lineToDelete=lineArray.pop()
//i think that that item can be deleted as follows
lineToDelete.removeMovieClip()
}
undoButton.onRelease = undo
off the top of my head, so if it doesn't work, sorry. i hope the undo function works...lol
-
Argh I can't even get the drawing part of that to work lol =X
-
edit: nvm took too long writing this out
-
lol, let me put it into flash and test it
edit: lol, my bad.
the line:
line.lineStyle=(2,0x000000,100)
should be:
line.lineStyle(2,0x000000,100)
-
Heh I got it working:
d=0
var lineArray:Array = new Array();
startx=0
starty=0
endx=0
endy=0
createEmptyMovieClip("line", 20);
onMouseDown = function(){
startx=_xmouse;
starty=_ymouse;
trace(startx);
line.moveTo(startx,starty);
}
onMouseUp = function(){
endx=_xmouse;
endy=_ymouse;
line.lineStyle(2,0x000000,100);
//line ends where the mouse button was released
line.lineTo(endx,endy);
lineArray.push(line);
trace(endy);
}
function undo(){
lineToDelete=lineArray.pop();
lineToDelete.removeMovieClip();
}
undoButton.onRelease = undo();
Sadly the undo function does not work, all it does is delete the whole drawing.
-
1 Attachment(s)
here's a demo .fla. click and drag anywhere within the white space to draw a line. then press the undo button. draw as many as you like. it will delete them one at a time in the order that they were drawn. btw, the reason the undo button doesn't work for you is because of the extra parentheses(sp?) at the end of the function
-
I see, I've got it working in my game using your code and everything im just having trouble getting my hero to hitTest properly with all the created clips.. This is the code I'm trying to use:
for (var i = 0; i<_root.lineArray.length; i+= 1) {
if (Key.isDown(Key.LEFT)) {
if (!_root.lineArray[i].hitTest(_x-_width/2, _y+_height/4, true)) {
_root._x += xspeed;
_root.menu._x -= xspeed;
this._x -= xspeed;
_root.flag._x -= xspeed;
}
}
}
-
is the hitTest code inside the character movieclip then? some of the problem might be that the lines are thin, so its hard to pick up the hitTest.
-
hmm. i'm stumped here too. i was able to stop character motion when he hit a wall, but its soooo buggy
-
My character absolutely refuses to hitTest the created clips as it would with just one clip. I got it now so it can hit the most recently added line but no others -.-
-
your problem with the current hitTesting is that the key press is captured inside the loop. i think that if you switched the lines like this:
PHP Code:
if (Key.isDown(Key.LEFT)) {
for (var i = 0; i<_root.lineArray.length; i+= 1) {
if (!_root.lineArray[i].hitTest(_x-_width/2, _y+_height/4, true)) {
_root._x += xspeed;
_root.menu._x -= xspeed;
this._x -= xspeed;
_root.flag._x -= xspeed;
}
}
}
you might have the proper results.
after you made me realize that i had no idea how to do this, i was up last night putting this swf together. see if it's what you want or not. unfortunately, i still have no idea how to properly do slopes lol. one more thing, at tight angles(say less than 60 degrees or so) the character can jump through the line above his head
-
Hehe I think your slope movements even better then mine ;). I'll try your code now :).
-
heh. how'd you do yours? i just set a pre-x and pre-y variable to see where the char was before he moved, then i tested to see if it hit a line, and if it did, i just set its x and y back to the pre-x and pre-y
-
My guys code is pretty simple, it uses a while function to see if your characters bottom is touching the terrain and if not it moves him up smoothly. (y--)
-
hmm,looking again at your game, i think you should increase the gravity a little bit. that will make the action of falling down a slope look a lot better and more realistic
-
Hey I tried what you said but I still am having some real unusual problems with the character. The while y--; thing isnt working properly on the various movieclips but only the first one and the character is moving way to fast =\. Oh and you were right about the gravity, =] increasing it made the slope movement a lot better.
-
hmm. well, the way i built my engine, i guess you could call it, it moves the character, not the rest of the mc's. so i'm not exactly sure how you could do that. i can tell you why everything is moving so fast though.
ok, before the loop happens, lets set a variable
spd1=5
ok, so, now if you use that variable to move something, it moves it fine, right?
look at what a loop does though, for every iteration of the loop, all of the code within the loop is called. test this by using a small loop and a trace comand inside of it and you'll see that what was supposed to be traced is traced several times. so...
for(var i=0;i<5;i++){
mc._x+=spd1
}
says that you are adding spd1 to the mc's x position everytime that the loop iterates, rather than just the initial time.
if it were me, i'd simply create a function that handles the hitTests with the loop inside that function separately, then return a boolean if there is a hitTest. after that, you can use the same movement code, except, you won't need the loop, and instead of saying "if(!wall.hitTest(char))" or w/e
you could say "if(!collDetected())"
where collDetected is the function i described earlier
-
ok i'm ganna have to build one now just to see if i can do it, god that's amazing squid, i'm sorry ab9003 i think i had more fun playing with squid's than yours
-
rofl, sorry 'bout that ab9003. of course, the only major difference i could see between mine and his is the gravity coming off of the slopes.
-
yea but i think the little figure that you built was what got me
-
lol, its just circle and a square...
-
Ouch what a stab in the heart, I worked so long on this project =[. Anyway the thing you said I tried to do but it didnt really work so I resorted to this:
for (var i = 0; i<_root.lineArray.length; i+= 1) {
while (_root.lineArray[i].hitTest(_x, _y+_height/2, true)) {
_y-= 1 /_root.d;
yspeed = 0;
jumping = 0;
}
}
It evens itself out by dividing the extra data out, but its a very poor way of solving the problem and rather ineifficient (not to mention not working so well), I just dont know what else to do..
-
you could try the method i use. it moves the items no matter what, but if the items hit, they are moved back.
-
Id just like my code to be something like this:
for (var i = 0; i<_root.lineArray.length; i+= 1) {
while (_root.lineArray[i].hitTest(_x, _y+_height/2, true))} (close for statement before while begins) {
_y-= 1 /_root.d;
yspeed = 0;
jumping = 0;
}
}
You know, so it only loops the hitTest but nothing else. Im having a hell of a time trying to make it work though =X
-
hmm...i'm not sure how to do it that way, sorry
-
Well like you were saying with the function before how would I change that to work as a function, I'm having trouble making it work that way.
-
well, it would be something like:
PHP Code:
function collDetect(obToDetect){
for(var i=0;i<lineArray.length;i++){
lineToTest = lineArray[i]
if(lineToTest.hitTest(char._x,char._y,true)){
return true
}
return false
}
then, way to add that to the movement code would be this:
PHP Code:
onEnterFrame = function(){
if(Key.isDown(Key.LEFT)){
if(!collDetect()){
//things to be moved
}
}
}
-
k i've got free time i wanna see if i can build something similar so i can add input
-
Heh slicer if you figure this out let me know, I'm very close to just giving up :(. Its so much work just to make an undo button -.-. Maybe I should look online for a whole different slope function then my own that works with created clips..
-
k here's what i came up with:
line drawer
i still have some problems with small lines but i think i have an idea how to fix it and he kinda looks weird walking on the ground anyways:
basically how i did the undo:
i have variable named cl //current line
and in the drawing line function it loops though the cl variable rather than the array length
so when i click undo button i just clear all the lines and my draw function simply...re-draws all the lines