00:00
00:00
Newgrounds Background Image Theme

JustAndrew just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Foss: Dino Game

1,862 Views | 15 Replies
New Topic Respond to this Topic

Foss: Dino Game 2005-07-27 12:07:59


FOSS: MAIN

I have been working on a little dinosaur game that we can all contribute to and add in our own little plugs and tweaks.

This is the basic structure of getting the dinosaur to move (animated only) and I was think we could make a city background scroll (so it appears he is moving) and he can smash buildings and stuff as he goes on (rather like that troll rampage thing on GOG) anyways here is the code it is ALL in API so all you need do is copy and paste it into frame 1. If anyone mods it please JUST add to the code because the aim is to have nothing in the library and the entire game in 1 frame so people can just copy the code.

Also I tried to put notes on it and I think they are sufficent
Any questions queries and of course mods please post below!

/* Sets initial variables */
var framed = 1;
_level0.begun = false;
_level0.timer = 0;
/* Declares the function draw_dino which basically checks
whether _level0.framed == 1 or 2 and then draws the relevant picture*/
function draw_dino(frame) {
_root.createEmptyMovieClip("dino", 2);
if (frame == 2) {
with (dino) {
lineStyle(5, 0x000000, 100);
/* this is where it draws the dinosaurs "spine"
so you could change colour etc here */
beginFill(0xFF9933, 100);
moveTo(412.1, 85.05);
lineTo(391.1, 82.05);
lineTo(360.1, 86.05);
lineTo(343.05, 114.05);
lineTo(336.05, 132.05);
lineTo(307.05, 146.05);
lineTo(282.05, 177.05);
lineTo(256.05, 235.05);
lineTo(158.05, 291.1);
lineTo(46, 327.1);
lineTo(44, 296.1);
lineTo(80, 310.1);
lineTo(83, 277.05);
lineTo(117, 300.1);
lineTo(120, 267.05);
lineTo(173.05, 280.05);
lineTo(171.05, 250.05);
lineTo(221.05, 254.05);
lineTo(213.05, 225.05);
lineTo(256.05, 223.05);
lineTo(248.05, 192.05);
lineTo(274.05, 179.05);
lineTo(267.05, 151.05);
lineTo(304.05, 148.05);
lineTo(318.05, 100.05);
lineTo(342.05, 111.05);
lineTo(319.05, 78.05);
lineTo(359.1, 84.05);
lineTo(376.1, 59);
lineTo(393.1, 77.05);
lineTo(407.1, 66);
lineTo(412.1, 85.05);
lineStyle(5, 0x000000, 100);
endFill();
/* this is where it draws his body again
color could be changed etc */
beginFill(0x009933, 100);
lineStyle(5, 0x000000, 100);
moveTo(420.1, 82.05);
lineTo(393.1, 78.05);
lineTo(367.1, 82.05);
lineTo(340.05, 128.05);
lineTo(305.05, 152.05);
lineTo(286.05, 174.05);
lineTo(259.05, 235.05);
lineTo(164.05, 289.1);
lineTo(52, 324.1);
lineTo(43, 346.1);
lineTo(92, 332.1);
lineTo(146, 336.1);
lineTo(190.05, 330.1);
lineTo(230.05, 312.1);
lineTo(281.05, 273.05);
lineTo(279.05, 311.1);
lineTo(251.05, 319.1);
lineTo(239.05, 318.1);
lineTo(236.05, 335.1);
lineTo(268.05, 368.1);
lineTo(298.05, 370.1);
lineTo(298.05, 358.1);
lineTo(279.05, 338.1);
lineTo(313.05, 329.1);
lineTo(311.05, 281.05);
lineTo(283.05, 274.05);
lineTo(348.05, 294.1);
lineTo(349.05, 315.1);
lineTo(342.05, 327.1);
lineTo(348.05, 339.1);
lineTo(404.1, 352.1);
lineTo(417.1, 341.1);
lineTo(408.1, 324.1);
lineTo(375.1, 317.1);
lineTo(376.1, 289.1);
lineTo(327.05, 250.05);
lineTo(336.05, 239.05);
lineTo(355.05, 188.05);
lineTo(330.05, 177.05);
lineTo(328.05, 170.05);
lineTo(332.05, 178.05);
lineTo(354.05, 185.05);
lineTo(367.1, 205.05);
lineTo(374.1, 195.05);
lineTo(388.1, 204.05);
lineTo(381.1, 173.05);
lineTo(342.05, 167.05);
lineTo(339.05, 159.05);
lineTo(341.05, 168.05);
lineTo(364.1, 171.05);
lineTo(384.1, 159.05);
lineTo(406.1, 174.05);
lineTo(404.1, 193.05);
lineTo(393.1, 184.05);
lineTo(387.1, 188.05);
lineTo(382.1, 172.05);
lineTo(363.1, 170.05);
lineTo(397.1, 152.05);
lineTo(479.1, 150.05);
lineTo(488.1, 111.05);
lineTo(429.1, 96.05);
endfill();
lineStyle(5, 0x000000, 100);
moveTo(378.1, 92.05);
lineTo(386.1, 102.05);
lineTo(414.1, 100.05);
lineTo(406.1, 88.05);
lineTo(378.1, 92.05);
lineStyle(5, 0x000000, 100);
moveTo(387.1, 109.05);
lineTo(388.1, 117.05);
lineTo(469.1, 144.05);
lineTo(397.1, 120.05);
lineTo(403.1, 139.05);
lineTo(418.1, 129.05);
lineTo(421.1, 142.05);
lineTo(441.1, 134.05);
lineTo(398.1, 120.05);
lineTo(388.1, 117.05);
lineTo(387.1, 109.05);
lineStyle(5, 0x000000, 100);
beginFill(0xFF0000, 100);
moveTo(397.1, 91.05);
lineTo(400.1, 102.05);
lineTo(412.1, 102.05);
lineTo(408.1, 88.05);
lineTo(397.1, 91.05);
endFill();
}
}


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-27 12:09:12


else if (frame == 1) {
with (dino) {
lineStyle(5, 0x000000, 100);
beginFill(0xFF9933, 100);
/* see the above notes to find out about which parts are draw where */
moveTo(412.1, 85.05);
lineTo(391.1, 82.05);
lineTo(360.1, 86.05);
lineTo(343.05, 114.05);
lineTo(336.05, 132.05);
lineTo(307.05, 146.05);
lineTo(282.05, 177.05);
lineTo(256.05, 235.05);
lineTo(158.05, 291.1);
lineTo(46, 327.1);
lineTo(44, 296.1);
lineTo(80, 310.1);
lineTo(83, 277.05);
lineTo(117, 300.1);
lineTo(120, 267.05);
lineTo(173.05, 280.05);
lineTo(171.05, 250.05);
lineTo(221.05, 254.05);
lineTo(213.05, 225.05);
lineTo(256.05, 223.05);
lineTo(248.05, 192.05);
lineTo(274.05, 179.05);
lineTo(267.05, 151.05);
lineTo(304.05, 148.05);
lineTo(318.05, 100.05);
lineTo(342.05, 111.05);
lineTo(319.05, 78.05);
lineTo(359.1, 84.05);
lineTo(376.1, 59);
lineTo(393.1, 77.05);
lineTo(407.1, 66);
lineTo(412.1, 85.05);
lineStyle(5, 0x000000, 100);
endFill();
beginFill(0x009933, 100);
moveTo(415.1, 87.05);
lineTo(421.1, 100.05);
lineTo(481.1, 115.05);
lineTo(475.1, 154.05);
lineTo(433.1, 154.05);
lineTo(390.1, 156.05);
lineTo(358.1, 173.05);
lineTo(378.1, 178.05);
lineTo(381.1, 194.05);
lineTo(390.1, 189.05);
lineTo(399.1, 200.05);
lineTo(400.1, 177.05);
lineTo(381.1, 163.05);
lineTo(359.1, 174.05);
lineTo(333.05, 172.05);
lineTo(331.05, 165.05);
lineTo(334.05, 172.05);
lineTo(376.1, 179.05);
lineTo(383.1, 206.05);
lineTo(368.1, 199.05);
lineTo(364.1, 208.05);
lineTo(350.05, 192.05);
lineTo(322.05, 183.05);
lineTo(319.05, 172.05);
lineTo(322.05, 182.05);
lineTo(350.05, 191.05);
lineTo(331.05, 243.05);
lineTo(317.05, 253.05);
lineTo(344.05, 271.05);
lineTo(361.1, 296.1);
lineTo(347.05, 323.1);
lineTo(369.1, 328.1);
lineTo(381.1, 335.1);
lineTo(375.1, 350.1);
lineTo(362.1, 350.1);
lineTo(337.05, 341.1);
lineTo(314.05, 340.1);
lineTo(334.05, 310.1);
lineTo(302.05, 263.05);
lineTo(335.05, 312.1);
lineTo(307.05, 344.1);
lineTo(316.05, 340.1);
lineTo(338.05, 341.1);
lineTo(362.1, 352.1);
lineTo(359.1, 362.1);
lineTo(346.05, 366.1);
lineTo(283.05, 364.1);
lineTo(278.05, 351.1);
lineTo(291.05, 325.1);
lineTo(312.05, 310.1);
lineTo(304.05, 316.1);
lineTo(276.05, 274.05);
lineTo(224.05, 316.1);
lineTo(186.05, 334.1);
lineTo(138, 337.1);
lineTo(88, 337.1);
lineTo(38, 350.1);
lineTo(47, 327.1);
lineTo(157.05, 292.1);
lineTo(224.05, 254.05);
lineTo(256.05, 234.05);
lineTo(284.05, 176.05);
lineTo(307.05, 146.05);
lineTo(337.05, 129.05);
lineTo(345.05, 112.05);
lineTo(363.1, 85.05);
lineTo(393.1, 83.05);
lineTo(417.1, 85.05);
lineTo(415.1, 87.05);
endfill();
lineStyle(5, 0x000000, 100);
moveTo(378.1, 92.05);
lineTo(386.1, 102.05);
lineTo(414.1, 100.05);
lineTo(406.1, 88.05);
lineTo(378.1, 92.05);
lineStyle(5, 0x000000, 100);
lineStyle(5, 0x000000, 100);
moveTo(387.1, 109.05);
lineTo(388.1, 117.05);
lineTo(469.1, 144.05);
lineTo(397.1, 120.05);
lineTo(403.1, 139.05);
lineTo(418.1, 129.05);
lineTo(421.1, 142.05);
lineTo(441.1, 134.05);
lineTo(398.1, 120.05);
lineTo(388.1, 117.05);
lineTo(387.1, 109.05);
lineStyle(5, 0x000000, 100);
beginFill(0xFF0000, 100);
moveTo(397.1, 91.05);
lineTo(400.1, 102.05);
lineTo(412.1, 102.05);
lineTo(408.1, 88.05);
lineTo(397.1, 91.05);
endFill();
}
}
}
/* this creates a black backround to begin with */
_root.createEmptyMovieClip("back", 1);
with (back) {
lineStyle(1, 0x000000, 100);
beginFill(0x000000, 100);
moveTo(0, 0);
lineTo(550, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 0);
endFill();
}
/* this then creates the text that goes on the background */
format = new TextFormat();
format.color = 0xff0000;
format.size = 40;
format.bold = true;
format.bullet = false;
format.font = "Maiandra GD";
_root.createTextField("credit", 2, 135, 200, 300, 700);
credit.text = "Ninja-chicken";
credit.setTextFormat(format);
_root.createTextField("title", 3, 125, 150, 300, 700);
title.text = "Dino Rampage";
title.setTextFormat(format);
format2 = new TextFormat();
format2.color = 0xff0000;
format2.size = 12;
format2.bold = true;
format2.bullet = false;
format2.font = "Maiandra GD";
_root.createTextField("instructions", 4, 0, 0, 300, 700);
instructions.text = "(Click to begin)";
instructions.setTextFormat(format2);

/* this listener is to detect whether or not the mouse has been pushed.
Once it has then it attachs the "player" MC and deletes all the other junk
(back and text etc */
someListener = new Object();
someListener.onMouseDown = function() {
title.removeTextField();
credit.removeTextField();
instructions.removeTextField();
_root.createEmptyMovieClip("player", 1);
_level0.draw_dino(_level0.framed);
dino._xscale = 50;
dino._yscale = 50;
dino._x = 100;
dino._y = 200;
/* this is the OnEnterFrame function for the dinosaur */
_root.player.onEnterFrame = function() {
/* this basically tells it to play its animation when the RIGHT key is down */
if (Key.isDown(Key.RIGHT)) {
trace(_level0.framed);
_level0.timer++;
if (_level0.timer == 10) {
_level0.timer = 0;
_level0.framed++;
if (_level0.framed == 3) {
_level0.framed = 1;
}
}

_level0.draw_dino(_level0.framed);
/* this maintains its place / size */

dino._xscale = 50;
dino._yscale = 50;
dino._x = 100;
dino._y = 200;
}
};
};
Mouse.addListener(someListener);

Any questions queries and of course mods please post below!


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-27 12:12:03


Post a demo?

Response to Foss: Dino Game 2005-07-27 12:13:18


Here is the source code in its entirety

http://www.freewebs...chicken/Dino_game.as

and here is what it does

http://img214.images..hp?image=dino3sh.swf

RIGHT = move thats about all at the moment but please add to it and post below!!!


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-27 12:13:19


Jesus! That's really long!!! Would this a kb game, then?

Response to Foss: Dino Game 2005-07-27 12:15:52


Dude.. make all your text unselectable. Add this..

credit.selectable=false;
instructions.selectable=false;
title.selectable=false;

Anyway, you haven't really done much but.. good graphics I guess for an API game. You used your API generator I suppose?


Sup, bitches :)

BBS Signature

Response to Foss: Dino Game 2005-07-27 12:18:54


At 7/27/05 12:15 PM, -liam- wrote: Dude.. make all your text unselectable. Add this..

credit.selectable=false;
instructions.selectable=false;
title.selectable=false;

Anyway, you haven't really done much but.. good graphics I guess for an API game. You used your API generator I suppose?

heh heh yeah. I know its not much but I am kind of new to API so thats my excuse. I added jumping though...

(use the link above if you want the source (I am overwriting the old one))


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-27 12:20:46


At 7/27/05 12:18 PM, Ninja-Chicken wrote: (use the link above if you want the source (I am overwriting the old one))

Ok, just change the text to unselectable and lose the trace thing.


Sup, bitches :)

BBS Signature

Response to Foss: Dino Game 2005-07-27 12:43:29


At 7/27/05 12:20 PM, -liam- wrote:
At 7/27/05 12:18 PM, Ninja-Chicken wrote: (use the link above if you want the source (I am overwriting the old one))
Ok, just change the text to unselectable and lose the trace thing.

What trace thing?


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-27 12:47:57


At 7/27/05 12:09 PM, Ninja-Chicken wrote: trace(_level0.framed);

That trace thing, I mean it's good for making sure everything works fine, but it's just annoying.


Sup, bitches :)

BBS Signature

Response to Foss: Dino Game 2005-07-27 15:58:36


At 7/27/05 12:47 PM, -liam- wrote:
At 7/27/05 12:09 PM, Ninja-Chicken wrote: trace(_level0.framed);
That trace thing, I mean it's good for making sure everything works fine, but it's just annoying.

oh woops. Heh I didnt see that. I think I deleted it if not then umm.... Yeah I will. I have added a bunch but I dont think anyone really cares so I think I'll just stop posting about it...


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-28 06:01:31


http://img301.images..hp?image=dino9ix.swf

Update-

Thanks inglor I stole your rain effect!


- Matt, Rustyarcade.com

Response to Foss: Dino Game 2005-07-28 06:52:33


Uhh..Weird...
I mean...Special >: )


BBS Signature

Response to Foss: Dino Game 2005-07-28 06:58:03


At 7/28/05 06:01 AM, Ninja-Chicken wrote: Thanks inglor I stole your rain effect!

that's why it's there dude :D

Response to Foss: Dino Game 2005-07-28 06:59:55


At 7/28/05 06:58 AM, Inglor wrote:
At 7/28/05 06:01 AM, Ninja-Chicken wrote: Thanks inglor I stole your rain effect!
that's why it's there dude :D

Yeah, you can't really steal open source stuff.


Sup, bitches :)

BBS Signature

Response to Foss: Dino Game 2005-07-28 07:16:57


At 7/28/05 06:59 AM, -liam- wrote:
At 7/28/05 06:58 AM, Inglor wrote:
At 7/28/05 06:01 AM, Ninja-Chicken wrote: Thanks inglor I stole your rain effect!
that's why it's there dude :D
Yeah, you can't really steal open source stuff.

Well you know what I mean. I think it looks pretty heh.
Well yeah I may get around to finishing this but I am much more interested in my game of gondor at the moment


- Matt, Rustyarcade.com