Jump to content

Grand Theft Auto in Flash


dcole.ath.cx

Recommended Posts

I'm making a game that's basicly like GTA but not with missions. You just go around, drive cars, shoot people maybe... I will see.Right now I have broken the game down and I'm making a example for each part before I put it all together. I haven't really made my own game like this before. My other games were work offs of tutorials... made into multi level, high scores and stuff.The game is a top-view Grand theft auto, where you can get into any car, pull trailers, shoot people. Get chased by the police or other cars...Right now it's broken into:Hero (you)personsCarstrailerscars on a mission (follow path)maploading map (Can't load it all at one time, too big)hitTestsave/loadSTARTIf anyone want to help me make the game they can, I will give credit to all. Here is a link to the fla and swf of the basic map with out buildings. FLA & SWFI have started on the cars, trailers, and map. I also started to draw the hero and person. Here is double trailers with a truck. 2 trailersAnd here is 1 trailer with an unhook function. trailer with unhook

Link to comment
Share on other sites

The controls that will be in the final thing will/could be:(I may have settings so you can change them)stearing -- WASDshift up/down -- -(minus) and Shift, then =change stearing radius -- []unhook -- CPark break -- PBreaks -- Space bar, End, S(reverse)shoot -- left mouseenter/exit car -- ESecond turning (for tank turret..) -- arrow keysPause/options -- QHelp -- H, /Zoom in/out -- , and .guns -- `(nothing), 1-9(guns), 0(bomb)auto down shift on&off -- Zmap -- F

Link to comment
Share on other sites

Help with making the city, making blocks which makes up the city (buildings)This way the city street are the same. I'm going to allow anyone to addon to the city... I don't want the town just in my view. sample fla of how to scroll around the city... load parts of the map.I need to break down the city so it doesn't slow down the loading, so the only part loaded is the part your seeing or about to see.how about a way to test if an abject hits one of an array of things (so I don't have to write a hitTest for every diffent object.

Link to comment
Share on other sites

Reporting in...The games going well. I finished the first version of the Map MakerFigured out how I'm going to do the scrolling... I'm going to insert the guy today or tomorrow. Then hopefully make it so he can enter the vehicles.Still got alot to do...

Link to comment
Share on other sites

If anyone's keeping track of what I'm up with this game... here is the rotating and scrolling... R&S.swf I needed a make that was only as big as the screen but as large as a state... so this is what I came up with... as you maybe able to tell I added a tutorial of background ratation and a scrolling background that only show the tiles that the screen can see and just out side of it. When you have 100,000,000 tiles and try to spin around and round you will see that it slows flash down and makes game play bad. Also I have updated the tiles/block creator... Map EditorAny one can add to the map of the game... all the is required is the flash player and some clicking skills.

Link to comment
Share on other sites

wow sounds awesome...I will have to play it when it is done.Just a question will you be providing the source for this when it is done. I would like to see how flash games work.

Link to comment
Share on other sites

Honestly said, at first it all seemed to me as if you won't get very much into this, but now when I've seen the map editor, it looks more and more promising.Here is a sample map I've generated:

name = [ [86,86,86,86,86,86,86,86,86,91,81,81,81,92,86,86,86,86,86,86,86,86,86,86,86],         [86,86,86,86,86,86,86,86,91,80,75,76,76,79,92,86,86,86,86,86,86,86,86,86,86],         [86,91,81,81,81,81,81,81,80,63,64,73,74,76,79,81,81,81,81,81,81,81,81,92,86],         [86,80,85,85,85,85,85,63,62,71,68,70,70,64,75,63,62,62,62,62,62,62,75,83,86],         [21,21,21,21,21,21,37,61,75,66,67,62,62,67,62,65,39,21,21,21,21,21,37,83,86],         [1,1,1,1,1,1,19,68,62,62,65,75,76,61,75,76,20,36,22,22,22,22,36,83,86],         [1,1,1,1,1,1,37,21,21,21,21,21,21,21,21,21,39,19,60,60,60,60,85,83,86],         [22,22,22,38,1,1,1,1,1,1,1,1,1,1,1,1,1,19,60,60,60,60,85,83,86],         [86,84,85,20,1,1,1,1,1,1,1,1,1,1,1,1,1,37,21,21,21,19,85,83,86],         [86,84,85,20,1,1,36,22,22,38,1,1,36,22,22,22,22,22,22,22,38,19,85,83,86],         [86,84,85,20,1,1,19,60,60,20,1,1,19,60,60,60,73,73,60,60,20,19,85,83,86],         [86,84,85,20,1,1,19,60,60,20,1,1,19,73,60,60,73,73,60,60,20,19,85,83,86],         [86,84,85,20,1,1,19,73,60,20,1,1,19,73,73,73,73,73,73,73,20,19,85,83,86],         [86,84,85,20,1,1,19,60,73,20,1,1,19,60,60,60,73,60,60,73,20,19,85,83,86],         [86,84,85,20,1,1,19,73,60,20,1,1,19,60,60,60,73,60,60,73,20,19,85,83,86],         [86,84,85,20,1,1,19,60,60,20,1,1,37,21,21,21,21,21,21,21,39,19,85,83,86],         [86,84,85,20,1,1,19,60,60,20,1,1,36,22,22,22,22,22,22,22,38,19,85,83,86],         [86,84,85,20,1,1,19,73,73,38,22,22,36,60,60,60,85,85,60,60,20,19,85,83,86],         [86,84,85,20,1,1,19,60,60,60,60,60,60,73,77,82,82,82,82,78,20,19,85,83,86],         [86,84,85,20,1,1,19,73,60,60,73,60,60,60,83,86,86,86,86,84,20,19,85,83,86],         [86,84,85,20,1,1,37,21,21,21,21,21,21,37,83,86,86,86,86,84,20,19,85,83,86],         [86,84,85,38,22,22,22,22,22,22,22,22,22,36,83,86,86,86,86,84,20,19,85,83,86],         [86,84,85,85,85,85,85,85,85,85,85,85,85,85,83,86,86,86,86,84,85,85,85,83,86],         [86,94,82,82,82,82,82,82,82,82,82,82,82,82,93,86,86,86,86,94,82,82,82,93,86],         [86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86] ];

But I must say your editor misses a few things:

  • Buildings. All sorts of them. In my generated map, I've replaced some with the ground, but that's only to get the rough idea.
  • Creating single line roads or even paths for humans is impossible, excluding the green paths, which I think should be for parks and other "green" areas only.
  • Inside corners for roads. There are outside ones, usefull for making crossroads, but there aren't any for managing road-to-street relations. In my generated map, I've used outside corners in the places for inside ones.

Link to comment
Share on other sites

Buildings are missing, I will create some for the editor some time... I really don't know what to do with them. Flat with some squares or something... some that look like houses. What are you thinking of for a one way road? you could have parking and a side walk on some side and a side walk without parking on the other... I may need to see a dough drawing to see what your thinking of...mine was like||//__||||//__||||//__||||//__||with __ because multiple space get ereased.

Link to comment
Share on other sites

What I mean with the corners is the same thing as with the water-to-beach corners (last 4 items on 4th row). To imagine the thing, just replace the water with a road, and a beach with a steet, grass or something. I call them inside, because the road is "enclosed" in them, unlike the outside ones, in which if you place them one next to another, it seems as if the road is around them.You already have lots of tails for roads. I'm pretty confused. That's why I've placed only "plain" roads. Maybe if you group them by class or something. I don't know.The only things you may add for supporting one line roads would be something like the one here:

name = [ [77,78,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [83,84,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [20,19,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [20,19,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [21,21,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [22,22,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [1,1,5,1,37,5,39,37,5,39,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [38,36,5,1,36,5,1,1,5,38,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],         [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5] ];

But include them in a single tile (and of course transform the beach into a road too). Or should we/I just draw bigger maps?

Link to comment
Share on other sites

On the map editor the 16,17,18, and 19 images on the 2nd row are road with side walk like the water and sand if that's kinda what your looking for.The map editor blocks are kinda small and hard to find... I'll have to come up with a better way or something! Also, I can't read the maps you are making yet. To keep things simple I just have the black and white blocks.------I've been working on the hero. hero.swf this has it so the you rotate the guy with the mouse and can move him in 4 basic directions with the arrow keys.. I should change it so it has 8 directions.I will have the keys different when you get inside the a car so that you have to be moving to go forward or backward, like in the 2 trailers and hook up files in easier posts, to turn left and right.------how should I put the other cars on the tiles, they will need to be inserted by AS but they need to be moved with one tile... think I can make a beta game there it tell you your X, Y, and angle to make that easier but if someone has a better idea I'm willing to change.

Link to comment
Share on other sites

On the map editor the 16,17,18, and 19 images on the 2nd row are road with side walk like the water and sand if that's kinda what your looking for.

Theese are the "outside" corners I was talking about.Follow theese steps:
  • Select image 16 and add it somewhere on the map.
  • Select image 17 and add it below image 16.
  • Select image 18 and add it on the right of image 16.
  • Select image 19 and add it on the right of image 17/below image 18.

You should see that the road is around the curb stone.Repeat the same steps with images 17, 18, 19, 20 on 4th row instead. You should see that the water is inside the beach area. Now imagine that the water is infact the road and the beach is the curb stone instead.The outside borders for beaches are the last 4 images on the last row. Imagine again thesame situation- the water is the road and the beach is the curb stone. Wow, we've got images 16-19/2nd row as the road equivalent of the last 4 of the 5th row, but where in earth are the equivalents for 17-20/4th row (sarcasm)?In short: the texture I have in mind is the 16-19/2nd row, but with the road in the place of the curb stone and the curb stone in the place of the road.

Link to comment
Share on other sites

boen_robot, I see what your talking about now.. I will make that block soon, along with some buildings.SFB wants the hero.swf walking to walk in the direction that the mouse is, then the left and right would move in 90 of that direction. so it you were pointing at 90*, up would be 90*, left would 180*, right would be 0*, and down would be 270. If you were pointing at 135*, up would be 135*, left would be 225*, right would be 45*, and down would be 315*.although this would make right left and left right when your pointing to the bottom of the screen.Is there a different way anyone wants it, do you want it the way I have it, SFB way or what?

Link to comment
Share on other sites

hey, I could help with the graphics if you still need it. I am not very advanced, but I think I can do something like that.that is, if the images can be created with a regular program and not flash.

Link to comment
Share on other sites

Any help well do...With the building and roads I'm drawing them in flash.With the cars, I'm getting them from images, then using a trace function in flash to make them into flash drawings.So if you make any images with another program I can just turn them into flash. I could also just remake the images in flash, taking the ideas in your drawing... this will keep the graphics more equal but give more graphics. It really the idea I'm looking for. Like the inner bend corner that was given earlier in this topic.

Link to comment
Share on other sites

you can right hand click and zoom in if that helps, other wise if you have a larger monitor. I can't really zoom in without having to have it scroll.Well I'm BASICLY done with each part. I still have to do shooting and killing...I have the hero walking done, I still need him to get in and out of cars. I have the car motion test done, trailer motion done. got how the map is going to function.I don't know how the cars are going to load though.

Link to comment
Share on other sites

wow this is all looking really great :)If you need any images / drawingsjust shout!Ed

Link to comment
Share on other sites

Games coming to a slow down... I'm going to have to develope mine and other people's ideas.I'm removing all hitTests from the game... they really slow it down. In one test file the car stop and will not function because they hitTest is True and False and the same time (or switches back and forth during the redering of the script)so I'm going to have to use X,Y location and distances from each object.I'm also starting to look at path finding, for police and stuff. I will upload 4 files or so to my blog and also post the script so people can look at them and give ideas for how to path find... If the entering and exiting gets done, I will beable to make the game with out other movement besides your own guy. I guess I could show off that much to prove myself.--- ---does anyone here but SFB understand AS or have the ability to understand it... like I don't know AS but it's so close to PHP that it's easy enough to do.

Link to comment
Share on other sites

I think the final script will only see tiles it can go though, then I will just have cars pick random spots on the map and plot a path there, I don't know about cars hitting each other... and can't do a hitTest. Maybe I will look at min or max, X or Y... then if the car is moving up, it will look at min Y. If it's moving left look at max X...O, then... if where looking at max X, I will get min and max Y and see if the cars min and max Y are between the other objects. ideas...here is the code for clicking a box and having the char plot and move to the tile.

fscommand("allowscale", false);fscommand("allowscale", false);// our map is 2-dimensional arraymyMap1 = [[1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 0, 1], [1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1]];// declare game object that holds infogame = {tileW:30, tileH:30};// walkable tilegame.Tile0 = function () { };game.Tile0.prototype.walkable = true;game.Tile0.prototype.frame = 1;// wall tilegame.Tile1 = function () { };game.Tile1.prototype.walkable = false;game.Tile1.prototype.frame = 2;// declare char object, xtile and ytile are tile where chars center ischar = {xtile:2, ytile:1, speed:2, moving:false};// building the worldfunction buildMap(map) {	// attach mouse cursor	_root.attachMovie("mouse", "mouse", 2);	// attach empty mc to hold all the tiles and char	_root.attachMovie("empty", "tiles", 1);	// declare clip in the game object	game.clip = _root.tiles;	// get map dimensions	game.mapWidth = map[0].length;	game.mapHeight = map.length;	// loop to place tiles on stage	for (var i = 0; i<game.mapHeight; ++i) {  for (var j = 0; j<game.mapWidth; ++j) { 	 // name of new tile 	 var name = "t_"+i+"_"+j; 	 // make new tile object in the game 	 game[name] = new game["Tile"+map[i][j]](); 	 // attach tile mc and place it 	 game.clip.attachMovie("tile", name, i*100+j*2); 	 game.clip[name]._x = (j*game.tileW); 	 game.clip[name]._y = (i*game.tileH); 	 // send tile mc to correct frame 	 game.clip[name].gotoAndStop(game[name].frame);  }	}	// add the character mc	game.clip.attachMovie("char", "char", 10000);	// declare clip in the game object	char.clip = game.clip.char;	// calculate starting position	char.x = (char.xtile*game.tileW)+game.tileW/2;	char.y = (char.ytile*game.tileW)+game.tileW/2;	// place char mc	char.clip._x = char.x;	char.clip._y = char.y;	char.clip.gotoAndStop(char.frame);}function moveChar(ob) {	// is char in the center of tile	if ((ob.x-game.tileW/2)%game.tileW == 0 and (ob.y-game.tileH/2)%game.tileH == 0) {  // calculate the tile where chars center is  ob.xtile = Math.floor(ob.x/game.tileW);  ob.ytile = Math.floor(ob.y/game.tileH);  if (game.clicked) { 	 game.clicked = false; 	 findPath(char.xtile, char.ytile, game.targetx, game.targety); 	 return;  }  if (game.path.length>0) { 	 game.targety = game.path.pop(); 	 game.targetx = game.path.pop(); 	 // right 	 if (game.targetx>ob.xtile) {    ob.dirx = 1;    ob.diry = 0;    // left 	 } else if (game.targetx<ob.xtile) {    ob.dirx = -1;    ob.diry = 0;    // up 	 } else if (game.targety>ob.ytile) {    ob.dirx = 0;    ob.diry = 1;    // down 	 } else {    ob.dirx = 0;    ob.diry = -1; 	 }  } else { 	 ob.moving = false; 	 return;  }	}	// move	ob.y += ob.speed*ob.diry;	ob.x += ob.speed*ob.dirx;	// update char position	ob.clip._x = ob.x;	ob.clip._y = ob.y;	// face the direction	ob.clip.gotoAndStop(ob.dirx+ob.diry*2+3);}function getTarget() {	// must click on walkable tile	if (game["t_"+game.ymouse+"_"+game.xmouse].walkable) {  // update target tile  game.targetx = game.xmouse;  game.targety = game.ymouse;  // if moving, wait until center is reached  if (!char.moving) { 	 findPath(char.xtile, char.ytile, game.targetx, game.targety);  } else { 	 game.clicked = true;  }	}}function addNode(ob, x, y, targetx, targety) {	// name of the new node	path.name = "node_"+y+"_"+x;	// add to the unchecked neighbours, if its walkable	if (game["t_"+y+"_"+x].walkable) {  // find estimated cost to the target  var cost = Math.abs(x-targetx)+Math.abs(y-targety);  // and if its not visited yet  if (path[path.name].cost>cost or path[path.name].cost == undefined) { 	 // make new node 	 path[path.name] = {x:x, y:y, visited:false, parentx:ob.x, parenty:ob.y, cost:cost}; 	 // add to the array 	 for (var i = 0; i<path.Unchecked_Neighbours.length; i++) {    if (cost<path.Unchecked_Neighbours[i].cost) {   	 path.Unchecked_Neighbours.splice(i, 0, path[path.name]);   	 break;    } 	 } 	 // didnt add it yet, too much cost, add to the end 	 if (i>=path.Unchecked_Neighbours.length) {    path.Unchecked_Neighbours[path.Unchecked_Neighbours.length] = path[path.name]; 	 }  }	}}function make_path(ob) {	// create path array	game.path = [];	// loop until no more parents	while (ob.parentx != null) {  // add the x and y  game.path[game.path.length] = ob.x;  game.path[game.path.length] = ob.y;  // mark the tile  game.clip["t_"+ob.y+"_"+ob.x].mark.gotoAndStop(2);  // make its parent new object  ob = path["node_"+ob.parenty+"_"+ob.parentx];	}	// start moving again	char.moving = true;	// show time it took to find path	_root.pathtime = getTimer()-game.pathTime add " ms";}function findPath(startx, starty, targetx, targety) {	// clear marked tiles	for (var i = 0; i<game.mapHeight; ++i) {  for (var j = 0; j<game.mapWidth; ++j) { 	 // name of new tile 	 var name = "t_"+i+"_"+j; 	 game.clip[name].mark.gotoAndStop(1);  }	}	// start timer	game.pathTime = getTimer();	// make new path object	path = {};	// make new array for unchecked tiles	path.Unchecked_Neighbours = [];	// not done yet	path.done = false;	// initialize	path.name = "node_"+starty+"_"+startx;	// create first node	var cost = Math.abs(startx-targetx)+Math.abs(starty-targety);	path[path.name] = {x:startx, y:starty, visited:true, parentx:null, parenty:null, cost:cost};	// add node to array	path.Unchecked_Neighbours[path.Unchecked_Neighbours.length] = path[path.name];	// loop	while (path.Unchecked_Neighbours.length>0) {  // get the next node  var N = path.Unchecked_Neighbours.shift();  // we've finished  if (N.x == targetx and N.y == targety) { 	 // done 	 make_path(N); 	 path.done = true; 	 break;  } else { 	 N.visited = true; 	 // right neighbour 	 addNode(N, N.x+1, N.y, targetx, targety); 	 // left neighbour 	 addNode(N, N.x-1, N.y, targetx, targety); 	 // up neighbour 	 addNode(N, N.x, N.y+1, targetx, targety); 	 // down neighbour 	 addNode(N, N.x, N.y-1, targetx, targety);  }	}	// remove path object	delete path;	// check if path was found	if (path.done) {  // we reached the goal  return true;	} else {  // we couldn't get there;  return false;	}}function work() {	// find on which tile mouse is	game.xmouse = Math.round((_root._xmouse-game.tileW/2)/game.tileW);	game.ymouse = Math.round((_root._ymouse-game.tileH/2)/game.tileH);	// place mouse mc	_root.mouse._x = game.xmouse*game.tileW;	_root.mouse._y = game.ymouse*game.tileH;	var ob = char;	// move char	if (!ob.moving) {  // stop walk animation  ob.clip.char.gotoAndStop(1);	} else {  moveChar(ob);  // walk animation  ob.clip.char.play();	}}// make the mapbuildMap(_root["myMap1"]);stop();

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...