Web Design Forum: A basic question about Overlay pattern... - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

A basic question about Overlay pattern... Rate Topic: -----

#1 User is offline   smartkid 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 60
  • Joined: 11-September 10
  • Reputation: 1
  • Gender:Male
  • Location:India
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 31 March 2011 - 12:13 PM

Hey guys i am quite new to flash..
i wanna know how to have an overly pattern on a flash movie,, like we see on fullscreen websites..??
i have the overly png but don't know how to set it on top..
thanks..
0

#2 User is offline   web-itec 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 533
  • Joined: 23-March 11
  • Reputation: 53
  • Gender:Male
  • Location:United Kingdom
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 31 March 2011 - 06:16 PM

View Postsmartkid, on 31 March 2011 - 12:13 PM, said:

Hey guys i am quite new to flash..
i wanna know how to have an overly pattern on a flash movie,, like we see on fullscreen websites..??
i have the overly png but don't know how to set it on top..
thanks..


if your doing it by actionscript apply .getNextHighestDepth() to the movieclip
if your doing it by frames then simply create a new frame and the pattern you want on top drag that layer to the top of all the other layers

youtube(dot)com/watch?v=YyUJLCrjsAg

found a little vid explaining briefly for you
0

#3 User is offline   smartkid 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 60
  • Joined: 11-September 10
  • Reputation: 1
  • Gender:Male
  • Location:India
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 01 April 2011 - 02:43 AM

Thanks and i wanna know how to tile the pattern as it is about 32*32px only.. And when i set the flash movie to strech the whole browser size the pixel pattern dosen't strech so that it lays nicely..
just like this demo has pattern overly
http://s3.envato.com...2380/index.html

thanks :)
0

#4 User is offline   web-itec 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 533
  • Joined: 23-March 11
  • Reputation: 53
  • Gender:Male
  • Location:United Kingdom
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 01 April 2011 - 11:40 AM

View Postsmartkid, on 01 April 2011 - 02:43 AM, said:

Thanks and i wanna know how to tile the pattern as it is about 32*32px only.. And when i set the flash movie to strech the whole browser size the pixel pattern dosen't strech so that it lays nicely..
just like this demo has pattern overly
http://s3.envato.com...2380/index.html

thanks :)


easiest way to do it if you have loads of tiles to do is by the while function, position 1 tile as a movieclip and set its x and y position to 0 and then create a for loop so it creates the same tile right across the page by using actionscript, use the loop and use the loop number as the new mc name and then in the same loop use that mc name and the number and move each movieclip created using the _x and _y in the actionscript so that its position is 32 * number in loop

Very hard to explain, but much easier if you sit and try and decipher what im trying to say :p
0

#5 User is offline   smartkid 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 60
  • Joined: 11-September 10
  • Reputation: 1
  • Gender:Male
  • Location:India
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 01 April 2011 - 02:08 PM

:blink: what?

This post has been edited by smartkid: 01 April 2011 - 02:08 PM

0

#6 User is offline   web-itec 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 533
  • Joined: 23-March 11
  • Reputation: 53
  • Gender:Male
  • Location:United Kingdom
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 01 April 2011 - 05:48 PM

View Postsmartkid, on 01 April 2011 - 02:08 PM, said:

:blink: what?


tilesize = 32; //tile Size
xlocstart = 190; //First title Centerpoint _x
ylocstart = 120; //First title Centerpoint _y
j = -1;
ymult = 0;
i = 0;
for(n=1; n <= 36; n++){
j++
i++
if(j==6) {
ymult = ymult + 1;
j = 0;
}

//create tile
hold = "tile" + [i];
var hold = tile.duplicateMovieClip("tile" + [i], i);

//set position
id = "tile" + [i];
xloc = xlocstart + (j * tilesize) + j;
yloc = ylocstart + (ymult * tilesize) + ymult;
setProperty(id, _x, xloc); //tile locx
setProperty(id, _y, yloc); //tile locy
}

open a new actionscript 2 file and dont create any frames, just paste the code above in the actions box, and then on the stage make a movieclip called tile 32px wide and 32px high and give it an instance name of tile and then see what it does, from that just mess about with the script 8)

Thats from a game a made ages ago, belows my full code if you want it lol, gotta learn as2 first though ;)

stop();
gamepath="carrun.swf";
//loads gamepath
url_split = _root._url.split("/"); //splits url into sections
file_name = url_split[url_split.length-1]; //game name eg game.swf
speed = 0.5; //Obj Speed
startspeed = speed;
leveld = "Level: " + _global.levels;
rmc = 10;
mute = false; //sounds not muted
pausef = false; //pause function
noturnsadd = 0;
scoreadd = 0;
scorenew = 0;
sp = false; //soundplay
bonusscore = 0;
lvl = _global.levels;
lvlover = false;
policedist = 0;
policebar.pbarback._xscale = 0;
gptimerold = 0;
objdiscount = 0;
//levels loaded in scene 1 on play btn
//scores loaded in scene 1 on play btn
scoreneeded = [xxx0,500,400,450,500,500,530,550,550,550,550,550,550,550,550,550,0,0,0,0];
rep = false; //repeat hittest
distcomp = 0; //distance complete
noturncount = 1; //count for noturn entry
csvardistcomp = 0;
timer = 5; //Countdown Timer
gptimer = -timer; //gameplay timer
xlocstart = 190; //First Square Centerpoint _x
ylocstart = 120; //First Square Centerpoint _y
sqsize = 63; //Square Size
countneeded = 1500; //Distance obj needs to travel to complete bar
barmove = 0; //Distance Bar
distancecount = 0; //Obj Distance Travelled
randstart = random(36) + 1; //Start Square
gamestart = false; //turns true when game begins
way1=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
sqtype=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
squp=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
sqdown=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
sqleft=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
sqright=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
noturns=[xxx0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
shape3c=[xxx0,3,3,3,3,3,3,4,5,5,8,8,9,8,7,8,9,10,10,10,10,10,10,0,0,0,0,0,0]; //Shape3 Chance etc
shape2c=[xxx0,16,16,16,18,18,18,18,18,18,20,20,20,20,30,30,30,30,0,0,0,0,0,0,0,0,0,0,0];
shape1c=[xxx0,100,97,95,95,94,93,92,92,92,92,91,91,91,91,91,85,0,0,0,0,0,0,0,0,0,0,0,0];
deadc=[xxx0,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,0,0,0,0,0,0,0];

j = -1;
ymult = 0;
i = 0;
for(n=1; n <= 36; n++){
j++
i++
if(j==6) {
ymult = ymult + 1;
j = 0;
}

//Create start
hold = "sq" + [i];
if(i==randstart && csvardistcomp == 0) {
var hold = shape4.duplicateMovieClip("sq" + [i], i);
startsq = i;
sqtype[i] = "start";
way1[i] = "start";
} else {

//create and chose shape
rand = random(100) + 1;
if(rand>=0 && rand<=shape3c[lvl]) {
var hold = shape3.duplicateMovieClip("sq" + [i], i);
sqtype[i] = "shape3";
} else if(rand>=shape3c[lvl]+1 && rand<=shape2c[lvl]) {
var hold = shape2.duplicateMovieClip("sq" + [i], i);
sqtype[i] = "shape2";
} else if(rand>=shape2c[lvl]+1 && rand<=shape1c[lvl]) {
var hold = shape1.duplicateMovieClip("sq" + [i], i);
sqtype[i] = "shape1";
} else if(rand>=shape1c[lvl]+1 && rand<=deadc[lvl]) {
var hold = dead.duplicateMovieClip("sq" + [i], i);
sqtype[i] = "dead";
}
}

//Rotate Shape Random
shapedir = random(100) + 1;
if(sqtype[i] == "shape1") {
if(shapedir>=0 && shapedir<=24) {
setProperty("sq" + [i], _rotation, 0);
way1[i] = "3";
} else if(shapedir>=25 && shapedir<=49) {
setProperty("sq" + [i], _rotation, 90);
way1[i] = "4";
} else if(shapedir>=50 && shapedir<=74) {
setProperty("sq" + [i], _rotation, 180);
way1[i] = "1";
} else if(shapedir>=75 && shapedir<=100) {
setProperty("sq" + [i], _rotation, -90);
way1[i] = "2";
}
} else if(sqtype[i] == "shape2") {
if(shapedir>=0 && shapedir<=49) {
way1[i] = "up";
} else if(shapedir>=50 && shapedir<=100) {
way1[i] = "right";
setProperty("sq" + [i], _rotation, 90);
}
} else if(sqtype[i] == "shape3") {
way1[i] = "both";
}

//set position
id = "sq" + [i];
xloc = xlocstart + (j * sqsize) + j;
yloc = ylocstart + (ymult * sqsize) + ymult;
setProperty(id, _x, xloc); //sq locx
setProperty(id, _y, yloc); //sq locy
squp[i]=((yloc - 0.5) - (sqsize / 2));
sqdown[i]=((yloc + 0.5) + (sqsize / 2));
sqleft[i]=((xloc - 0.5) - (sqsize / 2));
sqright[i]=((xloc + 0.5) + (sqsize / 2));
}

//Backfill
backfil = (sqsize * 6 + 5);
this.createEmptyMovieClip("bkfilmc",0());
bkfilmc.beginFill(0x000000);
bkfilmc.moveTo(0,0);//position start drawing from
bkfilmc.lineTo(backfil,0);//to x, y
bkfilmc.lineTo(backfil,backfil);//to x, y
bkfilmc.lineTo(0,backfil);//to x, y
bkfilmc.lineTo(0,0);//to x, y
bkfilmc._x = xlocstart - (sqsize / 2);
bkfilmc._y = ylocstart - (sqsize / 2);

//Change Ways Numbers
turnpntx = [xxx,sq1._x,sq2._x,sq3._x,sq4._x,sq5._x,sq6._x,sq7._x,sq8._x,sq9._x,sq10._x,sq11._x,sq12._x,sq13._x,sq14._x,sq15._x,sq16._x,sq17._x,sq18._x,sq19._x,sq20._x,sq21._x,sq22._x,sq23._x,sq24._x,sq25._x,sq26._x,sq27._x,sq28._x,sq29._x,sq30._x,sq31._x,sq32._x,sq33._x,sq34._x,sq35._x,sq36._x];
turnpnty = [yyy,sq1._y,sq2._y,sq3._y,sq4._y,sq5._y,sq6._y,sq7._y,sq8._y,sq9._y,sq10._y,sq11._y,sq12._y,sq13._y,sq14._y,sq15._y,sq16._y,sq17._y,sq18._y,sq19._y,sq20._y,sq21._y,sq22._y,sq23._y,sq24._y,sq25._y,sq26._y,sq27._y,sq28._y,sq29._y,sq30._y,sq31._y,sq32._y,sq33._y,sq34._y,sq35._y,sq36._y];

var obj = obj2.duplicateMovieClip("obj", 50);
startx = turnpntx[startsq];
starty = turnpnty[startsq];
setProperty(obj, _x, startx);
setProperty(obj, _y, starty);

function wayfunc(){
if(noturn == xn) {
//NO TURN
} else {
this["sq"+xn]._rotation += 90;

if(xn == startsq && !gamestart) {
obj._rotation += 90;
}
}
if(sqtype[xn] == "shape1") {
	if (way1[xn]==4) {
	way1[xn] = "1";
} else {
	way1[xn]++
}
} else if(sqtype[xn] == "shape2") {
if(way1[xn] == "right") {
way1[xn] = "up";
} else {
way1[xn] = "right";
}
} else if(sqtype[xn] == "shape3") {
way1[xn] = "both";
} else if(sqtype[xn] == "start") {
way1[xn] = "start";
}
}

//Countdown till start
timermc.swapDepths(988);
countdown = function(){
if(!pausef) {
timer--;
if(timer>=1) {
timersnd = new Sound();
timersnd.attachSound("timer");
timersnd.start();
}
}
if(timer==0){
timersnd = new Sound();
timersnd.attachSound("timerfin");
timersnd.start();
movement = true;
noturn = startsq;
gamestart = true;
} else if(timer<=-1) {
removeMovieClip(timermc);
clearInterval(countdownInterval);
}
}
countdownInterval = setInterval(countdown,1000);

submitscore.submit.onRelease = function() {
submitscore.loadVariables("highscorepost.php", "POST");
getURL("javascript:highscoredisplay('highscoredisplay.php?page=carrun')");
tellTarget(submitscore) {
gotoAndStop(3);
}
}


mutebtn.onRelease = function() {
	if(!mute) {
	mute = true;
	timersnd.setVolume(0);
	crash.setVolume(0);
	newsq.setVolume(0);
	tellTarget(mutebtn) { gotoAndStop(2); }
	} else {
	mute = false;
	timersnd.setVolume(99);
	crash.setVolume(99);
	newsq.setVolume(99);
	tellTarget(mutebtn) { gotoAndStop(1); }
	}
}

mainmenubtn.onRelease = function() {
_global.levels = 1;
_global.autoplay = false;
unloadMovieNum(file_name);
loadMovieNum(file_name, 0);
}

pausebtn.onRelease = function() {
if(!pausef) {
setProperty(pausemc, _visible, 1);
pausemc.swapDepths(1001);
movement = false;
pausef = true;
} else {
setProperty(pausemc, _visible, 0);
pausef = false;
if(timer<=0) {
movement = true;
}}}
pausemc.onRelease = function() {
setProperty(pausemc, _visible, 0);
pausef = false;
if(timer<=0) {
movement = true;
}
}

fastbtn.onRelease = function() { //from inside onEF
if(objdir == "up" || objdir == "down") {
newmove = Math.round(obj._y); //Rounds obj._y to a whole number
obj._y = newmove;
} else if(objdir == "left" || objdir == "right") {
newmove = Math.round(obj._x); //Rounds obj._x to a whole number
obj._x = newmove;
}
speed = 1;
fast = true;
}

//Gameplay timer for bonus score
countup = function(){ //bonus score (TIME)
if(!pausef) {
gptimer++;
}
}
countupInterval = setInterval(countup,1000);

function roadblockmk() {
rand = random(36) + 1;
roadblknew = "sq" + [rand];
removeMovieClip(roadblknew);
var roadblknew = roadblock.duplicateMovieClip(roadblknew, rand);
setProperty(roadblknew, _x, turnpntx[rand]);
setProperty(roadblknew, _y, turnpnty[rand]);
sqtype[rand] = "dead";
}

this.onEnterFrame = function() {
//police dist
if(gptimer >= 10) {
if(!pausef) {
policedist += 1.65;
policebarper = Math.round((policedist / objdiscount) * 100);
if(policebarper >= 100) {
tellTarget(policebar) {
play();
}
policebar.pbarback._xscale = 100;
if(gptimer >= gptimerold) {
gptimerold = gptimer+3;
roadblockmk();
}

} else {
tellTarget(policebar) {
gotoAndStop(1);
}
policebar.pbarback._xscale = policebarper;
}
}
}

if(obj._x <= 150 || obj._x >= 550 || obj._y <= 80 || obj._y >= 480) {
objhit();
}

if(!lvlover) {
scorenew = (scoreadd * 10);
scoredisplay = "Score: " + scorenew;
}
barmove = distancecount * (countbar._xscale / countneeded);
if(barmove >= 1) {
barmove = 0;
distancecount = 0;
tellTarget(countbar) {
	nextFrame();
}
}

for(sw=1; sw <= 36; sw++) {
if(obj._x == sqleft[sw] && obj._y == turnpnty[sw] && objdir == "left" || obj._x == sqright[sw] && obj._y == turnpnty[sw] && objdir == "right" || obj._y == squp[sw] && obj._x == turnpntx[sw] && objdir == "up" || obj._y == sqdown[sw] && obj._x == turnpntx[sw] && objdir == "down") {
hold2 = "sq" + [sw];
removeMovieClip("sq" + [sw]);
if(sqtype[sw] == "dead" && sw == startsq) {
var hold2 = shape11.duplicateMovieClip("sq" + [sw], sw);
setProperty("sq" + [sw], _x, turnpntx[sw]);
setProperty("sq" + [sw], _y, turnpnty[sw]);
startsq = 987;
} else {
var hold2 = shape10.duplicateMovieClip("sq" + [sw], sw);
setProperty("sq" + [sw], _x, turnpntx[sw]);
setProperty("sq" + [sw], _y, turnpnty[sw]);
}
}

if(obj._x == sqleft[sw] && obj._y == turnpnty[sw] && objdir == "right" || obj._x == sqright[sw]  && obj._y == turnpnty[sw] && objdir == "left" || obj._y == squp[sw] && obj._x == turnpntx[sw] && objdir == "down" || obj._y == sqdown[sw] && obj._x == turnpntx[sw] && objdir == "up") {
noturn = sw; //Shape No Rotate
if(!lvlover) {
newsq = new Sound();
newsq.attachSound("newsq");
newsq.start();
scoreadd++
if(fast) {
scoreadd++ //double points for fast
}
}

for(w=1; w <= 36; w++) {
if(noturns[w] == sw) {
objhit();
}
}
noturns[noturncount] = sw;
noturncount++
}
} //for[sw] end

function hittest() {
if(csvar == 1) {
newsq = new Sound();
newsq.attachSound("newsq");
newsq.start();
}	
	
if(distcomp == 1 && csvar == 1) {
tellTarget(countbar) {
	gotoAndStop(1);
}

for(cd=1; cd <= 36; cd++) {
nt = noturns[cd];
noturns[cd] = 0;

if(nt >= 1) {
removeMovieClip("sq" + nt);
} else {
break
}
hold = "sq" + [nt];

rand = random(100) + 1;
if(!skipto) {
if(rand>=0 && rand<=shape3c[lvl]) {
var hold = shape3.duplicateMovieClip("sq" + [nt], nt);
sqtype[nt] = "shape3";
} else if(rand>=shape3c[lvl]+1 && rand<=shape2c[lvl]) {
var hold = shape2.duplicateMovieClip("sq" + [nt], nt);
sqtype[nt] = "shape2";
} else if(rand>=shape2c[lvl]+1 && rand<=shape1c[lvl]) {
var hold = shape1.duplicateMovieClip("sq" + [nt], nt);
sqtype[nt] = "shape1";
} else if(rand>=shape1c[lvl]+1 && rand<=deadc[lvl]) {
var hold = dead.duplicateMovieClip("sq" + [nt], nt);
sqtype[nt] = "dead";
}

setProperty(hold, _x, turnpntx[nt]);
setProperty(hold, _y, turnpnty[nt]);

//Rotate Shape Random
shapedir = random(100) + 1;
if(sqtype[nt] == "shape1") {
if(shapedir>=0 && shapedir<=24) {
setProperty("sq" + [nt], _rotation, 0);
way1[nt] = "3";
} else if(shapedir>=25 && shapedir<=49) {
setProperty("sq" + [nt], _rotation, 90);
way1[nt] = "4";
} else if(shapedir>=50 && shapedir<=74) {
setProperty("sq" + [nt], _rotation, 180);
way1[nt] = "1";
} else if(shapedir>=75 && shapedir<=100) {
setProperty("sq" + [nt], _rotation, -90);
way1[nt] = "2";
}
} else if(sqtype[nt] == "shape2") {
if(shapedir>=0 && shapedir<=49) {
way1[nt] = "up";
} else if(shapedir>=50 && shapedir<=100) {
way1[nt] = "right";
setProperty("sq" + [nt], _rotation, 90);
}
} else if(sqtype[nt] == "shape3") {
way1[nt] = "both";
}
} else if(sqtype[nt] == "dead") {
way1[nt] = "dead";
}
	
} //for[cd] end
distcomp = 0;
csvar = 0;
noturncount = 1; //reset turns counter
noturns[noturncount] = noturnsadd; //first square entered after side change
noturncount++ //moves array, turn count 1st square now not replaced
scoreadd++
} else {
if(csvar == 1) {
noturns[noturncount] = noturnsadd; //first square entered after side change
noturncount++
csvar = 0;
}
}
if(rep) {
rep = false;
objhit();
} else {
for(k=1; k <= 36; k++) {
if(sqtype[k]=="start") {
sqtype[k]="dead";					  
}
if(obj._x == sqleft[k] && obj._y == turnpnty[k] && objdir == "right") {
if(way1[k]==2 || way1[k]==3 || way1[k]=="up" || sqtype[k]=="dead") { //Shapes it cant go through
rep = true;
hittest(); //objalreadyhit
}
} else if(obj._x == sqright[k]  && obj._y == turnpnty[k] && objdir == "left") {
if(way1[k]==1 || way1[k]==4 || way1[k]=="up" || sqtype[k]=="dead") { //Shapes it cant go through
rep = true;
hittest();
}
} else if(obj._y == squp[k] && obj._x == turnpntx[k] && objdir == "down") {
if(way1[k]==3 || way1[k]==4 || way1[k]=="right" || sqtype[k]=="dead") { //Shapes it cant go through
rep = true;
hittest();
}
} else if(obj._y == sqdown[k] && obj._x == turnpntx[k] && objdir == "up") {
if(way1[k]==1 || way1[k]==2 || way1[k]=="right" || sqtype[k]=="dead") { //Shapes it cant go through
rep = true;
hittest();
}}}
} //for[k] end
} //Function end

for(p=1; p<=36; p++) {
this["sq"+p].xn = p;
if(noturn == p) {
this["sq"+p].onPress = function() {
xn = this.xn;
}
} else {
this["sq"+p].onPress = function() {
xn = this.xn;
wayfunc();
}}}

//Obj moves to opposite square
for(cs=1; cs <= 36; cs++) { 
if(objdir == "left" && cs == noturn && obj._x == sqleft[cs]) {
obj._x = sqright[cs+5]; //new obj place
speed = startspeed;
noturnsadd = cs+5;
csvar = 1;
fast = false;
hittest();
}
if(objdir == "right" && cs == noturn && obj._x == sqright[cs]) {
obj._x = sqleft[cs-5];
speed = startspeed;
noturnsadd = cs-5;
csvar = 1;
fast = false;
hittest();
}
if(objdir == "up" && cs == noturn && obj._y == squp[cs]) {
obj._y = sqdown[cs+30];
speed = startspeed;
noturnsadd = cs+30;
csvar = 1;
fast = false;
hittest();
}
if(objdir == "down" && cs == noturn && obj._y == sqdown[cs]) {
obj._y = squp[cs-30];
speed = startspeed;
noturnsadd = cs-30;
csvar = 1;
fast = false;
hittest();
}} //for[cs] end

//When Obj Reaches Turnpoint
for(q=0; q <= 36; q++) {
	if(obj._x == turnpntx[q] && obj._y == turnpnty[q]) {
objrotation();
	}
}	

//Obj Movement
	if(movement)
	{
		if (obj._rotation == 90) {
		obj._x = obj._x + speed;
		objdir = "right";
		objdiscount++
		if(fast) { objdiscount++ }
		hittest(); //every movement do hittest
		distcount();
		} else if (obj._rotation == 180) {
		obj._y = obj._y + speed;
		objdir = "down";
		objdiscount++
		if(fast) { objdiscount++ }
		hittest(); //every movement do hittest
		distcount();
		} else if (obj._rotation == -90) {
		obj._x = obj._x - speed;
		objdir = "left";
		objdiscount++
		if(fast) { objdiscount++ }
		hittest(); //every movement do hittest
		distcount();
		} else if (obj._rotation == 0) {
		obj._y = obj._y - speed;
		objdir = "up";
		objdiscount++
		if(fast) { objdiscount++ }
		hittest(); //every movement do hittest
		distcount();
		}
	}
} //onEnterFrame END

function distcount() {
distancecount++
if(fast) {
	distancecount++ //double distance count for fast
	}
}

//decides which way obj turns
function objrotation() {
	if(way1[q]==3 && objdir=="up" || way1[q]==2 && objdir=="down") {
	obj._rotation = 90;
	} else if(way1[q]==4 && objdir=="right" || way1[q]==3 && objdir=="left") {
	obj._rotation = 180;
	} else if(way1[q]==4 && objdir=="up" || way1[q]==1 && objdir=="down") {
	obj._rotation = -90;
	} else if(way1[q]==2 && objdir=="left" || way1[q]==1 && objdir=="right") {
	obj._rotation = 0;
	} else if(way1[q]=="up" && objdir=="up" || way1[q]=="up" && objdir=="down" || way1[q]=="right" && objdir=="right" || way1[q]=="right" && objdir=="left") {
	// NO CHANGE IN DIRECTION
	} else if(way1[q]=="both") {
	// NO CHANGE IN DIRECTION
	} else if(way1[q]=="start") {
	// NO DIE
	} else {
	objhit();
	}
}

function objhit() {
delete this.onEnterFrame;
finalscore = (_root.gptimer * 2) + _root.scorenew;

gamestart = false;
crash = new Sound();
crash.attachSound("crash");
if(!sp) {
crash.start();
sp = true; //soundplay = played
}
lvlover = true;
movement = false;
tellTarget(obj){
play();
}
_global.scoreov[lvl] = finalscore;

if(finalscore >= scoreneeded[_global.levels]) {
passfail = "Passed";
} else {
passfail = "Failed";
submitscore.swapDepths(1003);
tellTarget(submitscore) {
play();
}
tellTarget(nxtlvl.passfailmc) {
gotoAndStop(2);
}
}
nxtlvl.swapDepths(987);
tellTarget(nxtlvl) {
play();
}

nxtlvl.passfailmc.onPress = function() {
if(passfail == "Passed") {
_global.levels++
} else {
_global.levels = 1;
}
_global.autoplay = true;
unloadMovieNum(gamepath);
loadMovieNum(gamepath, 0);
}
}

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users