# Flash Game Ice age

**URL:** <https://forum.kirupa.com/t/flash-game-ice-age/244423>\
**Category:** flash\
**Created:** [November 17, 2007, 9:34pm UTC](https://forum.kirupa.com/t/flash-game-ice-age/244423 "2007-11-17T21:34:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navs\_dhinki](https://avatars.discourse-cdn.com/v4/letter/n/50afbb/32.png) [@Navs\_dhinki](https://forum.kirupa.com/u/Navs_dhinki)\
**Post date:** [November 17, 2007, 9:34pm UTC](https://forum.kirupa.com/t/flash-game-ice-age/244423/1 "2007-11-17T21:34:47Z")

</div>

HI,  
I am new to flash game programming and I am on a project for the game Ice Age which i found in a ebook(i dont have CD just Ebook) Game Design Demystified by Job Makar. The data given in that book was not sufficient. I have developed all the graphics & movie clips required. Now I am having problems in the following areas:

1. He has told to use level data in XML format which i don’t know how to incorporate in flash.
2. I am unable to understand level editor. However i will be satisfied even if I make 1 level.  
3.Few of the functions used in action script are not defined viz addFrictionAndGravity(), createTempPosition(),detectFlag(),checkFloor(),renderScreen().  
4.When i test movie nothing comes(no errors & blank screen).

It will be a great help if anyone could help and give me strategy where to start and what steps to follow. This is my school project and I wanna finish it fast. PLEASE HELP…

The ActionScript in use is as follows

game = {};  
game.bg = {};  
game.bg.clip = gameClip.bg;  
game.bg.x = 0;  
game.bg.y = 0;  
game.bg.height = game.bg.clip.\_height;  
game.bg.width = game.bg.clip.\_width;  
game.overlay = {};  
game.overlay.clip = gameClip.overlay;  
game.overlay.x = 0;  
game.overlay.y = 0;  
game.hero = {};  
game.hero.clip = gameClip.overlay.man;  
hero = game.hero;  
hero.lives = game.numLives-1;  
clip = game.hero.clip;  
hero.xmov = 0;  
hero.startx = 50;  
hero.starty = 320;  
hero.standingHeight = 50;  
hero.crouchingHeight = 30;  
hero.width = 23;  
hero.height = hero.standingHeight;  
hero.ymov = 0;  
hero.minXmov = .75;  
hero.maxXmov = 12;  
hero.groundWalkIncrement = 1.7;  
hero.airWalkIncrement = .85;  
hero.pushSpeed = 4;  
hero.walkIncrement = hero.groundWalkIncrement;  
hero.jumpSpeed = 23;  
hero.clip.swapDepths(1000000);  
game.runDecay = .85;  
game.depth = 10000;  
game.floor = 330;  
game.viewableHeight = 350;  
game.viewableWidth = 680;  
game.walkAbleWidth = 4800;  
game.walkAbleHeight = 4000;  
game.xScrollFactor = (game.bg.width-game.viewableWidth)/game.walkAbleWidth;  
game.yScrollFactor = game.bg.height/game.walkAbleHeight;  
game.gravity = 2;  
game.windResistance = .92;  
game.numLives = 3;  
this.onEnterFrame = function() {  
if (game.inPlay) {  
if (!hero.dead) {  
listenForKeys();  
}  
addFrictionAndGravity();  
createTempPosition();  
if (!hero.dead) {  
baddyDetection();  
platformDetect();  
collectableDetect();  
detectFlag();  
checkFloor();  
}  
renderScreen();  
}  
};  
function listenForKeys() {  
hero.wasCrouching = hero.isCrouching;  
if (hero.inAir) {  
hero.walkIncrement = hero.airWalkIncrement;  
} else {  
hero.walkIncrement = hero.groundWalkIncrement;  
}  
if (Key.isDown(Key.RIGHT) && (!hero.isCrouching || (hero.isCrouching && hero.inAir))) {  
hero.xmov += hero.walkIncrement;  
hero.walkRight();  
} else if (Key.isDown(Key.LEFT) && (!hero.isCrouching || (hero.isCrouching && hero.inAir))) {  
hero.xmov -= hero.walkIncrement;  
hero.walkLeft();  
}  
if ((Key.isDown(Key.SPACE) || Key.isDown(Key.UP)) && okToJump) {  
okToJump = false;  
if (!hero.isJumping && !hero.inAir) {  
hero.inAir = true;  
hero.ymov -= hero.jumpSpeed;  
hero.jump();  
}  
} else if (!Key.isDown(Key.SPACE) && !Key.isDown(Key.UP)) {  
okToJump = true;  
}  
if (Key.isDown(Key.DOWN)) {  
hero.crouch();  
} else {  
hero.unCrouch();  
}  
}  
function platformDetect() {  
var oldOnPlatform = hero.onPlatform;  
var onPlatform = false;  
for (var i = 0; i\<game.platforms.column.length; ++i) {  
var platform = game.platforms.column\*;  
var px = platform.x;  
var py = platform.y;  
var pw = platform.width;  
var ph = platform.height;  
var type = platform.type;  
for (var iteration = 1; iteration\<=game.totalIterations; ++iteration) {  
hero.tempx = hero.x+(hero.xmov/game.totalIterations)_iteration;  
hero.tempy = hero.y+(hero.ymov/game.totalIterations)iteration;  
if ((hero.tempx+hero.width\>px) && (hero.tempx\<px+pw) && (hero.tempy-hero.height\<py+ph) && (hero.tempy\>py)) {  
// find which side he hit.  
if (hero.tempy\>py && hero.y\<=py+.01 && hero.tempy\<py+ph && hero.ymov\>0) {  
//landed on top  
//the .01 is for a comparison error  
var onPlatform = true;  
var platformTop = py;  
landOnPlatform(platformTop);  
if (platform.mover == “yes”) {  
var xinc = platform.xspeed+hero.xmov.5;  
hero.x += xinc;  
hero.y += platform.yspeed+hero.ymov_.5;  
hero.tempx = hero.x;  
hero.tempy = hero.y;  
}  
} else if (type != “cloud” && hero.tempy-hero.height\>py && hero.tempy-hero.height\<py+ph && hero.tempx+hero.width/2\>px && hero.tempx\<px+pw-hero.width/2 && hero.ymov\<0) {  
//hit from underneath  
var newy = py+ph+hero.height;  
bounceOffOfBottom(newy);  
if (platform.container) {  
platform.clip.item.gotoAndPlay(“Display”);  
display.num2 = Number(display.num2)+1;  
playSound(“collect”);  
if (–platform.containerCounter\<=0) {  
platform.container = false;  
}  
}  
} else if (type != “cloud” && hero.tempx+hero.width\>px && hero.tempx+hero.width\<px+pw) {  
//hit the left side of the platform  
if (!hero.wasCrouching) {  
var newx = px-hero.width;  
bounceOffOfPlatform(newx);  
} else {  
hero.crouch();  
var crouchMove = true;  
var left = true;  
}  
} else if (type != “cloud” && hero.tempx\>px && hero.tempx\<px+pw) {  
//hit the right side of the platform  
if (!hero.wasCrouching) {  
var newx = px+pw;  
bounceOffOfPlatform(newx);  
} else {  
hero.crouch();  
var crouchMove = true;  
var left = false;  
}  
}  
}  
}  
}  
hero.onPlatform = onPlatform;  
if (crouchMove) {  
if (left) {  
hero.tempx -= hero.pushSpeed;  
} else {  
hero.tempx += hero.pushSpeed;  
}  
}  
if (!hero.onPlatform && oldOnPlatform) {  
//he just left a platform  
hero.inAir = true;  
}  
}  
function baddyDetection() {  
for (var i = 0; i\<game.baddies.length; ++i) {  
var baddy = game.baddies\*;  
if (hero.clip.hitTest(baddy.clip.hitArea)) {  
if (hero.ymov\>game.gravity) {  
//baddy squashed  
hero.tempy = hero.y;  
hero.ymov = -10;  
killBaddy(baddy, i);  
} else {  
//hero died  
hero.ymov = -20;  
hero.xmov = 15;  
hero.die();  
}  
}  
}  
}  
function collectableDetect() {  
for (var i = 0; i\<game.collectables.length; ++i) {  
var ob = game.collectables\*;  
if (hero.clip.hitTest(ob.clip) && !ob.captured) {  
display.num2 = Number(display.num2)+1;  
playSound(“collect”);  
ob.captured = true;  
ob.clip.gotoAndPlay(“Capture”);  
}  
}  
}
