Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

AS3 Error

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 MrPhoenix   Members   

134
Like
0Likes
Like

Posted 01 February 2013 - 09:03 PM

im trying to get 2 movieclips to put there self above eachother when the other reachs the bottom of the stage

but it does not meet line to line, the stage width is 480 and height 800

and it gets faster and faster

import flash.events.Event;

stop();

function repeatBackground():void {
	
	if(gameBackground01.y + gameBackgroundY > 799) {
		gameBackground01.y = -800;
	}
	if(gameBackground02.y + gameBackgroundY > 799) {
		gameBackground02.y = -800;
	}
	if(gameBackgroundY > 799) {
		gameBackgroundY = 0;
	}
	
	gameBackgroundY++;
}

function gameLoop(e:Event):void {
	if(gamePause == 0) {
		repeatBackground();
		gameBackground01.y += gameBackgroundY;
		gameBackground02.y += gameBackgroundY;
	} else {
		
	}
}

gameBackground01.x = 0;
gameBackground01.y = -800;
gameBackground02.x = 0;
gameBackground02.y = 0;

addEventListener(Event.ENTER_FRAME, gameLoop);

 

 



#2 MrPhoenix   Members   

134
Like
0Likes
Like

Posted 01 February 2013 - 09:47 PM

fixed it but it seems to lag in some spots

 

import flash.events.Event;

stop();

function repeatBackground():void {
	
	if(gameBackground01.y >= 800) {
		gameBackground01.y = -800;
	}
	if(gameBackground02.y >= 800) {
		gameBackground02.y = -800;
	}
	
	gameBackground01.y += 4;
	gameBackground02.y += 4;
}

function gameLoop(e:Event):void {
	if(gamePause == 0) {
		repeatBackground();
	} else {
		
	}
}

addEventListener(Event.ENTER_FRAME, gameLoop);

 

 

what if i wanted to add speed like setup a var speedVar:int = 2;

i tryed this but it wont work 

   gameBackground01.y += speedVar * 4;

   gameBackground02.y += speedVar * 4;



#3 Khatharr   Members   

8642
Like
0Likes
Like

Posted 02 February 2013 - 04:50 AM

In what way did it not work?
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#4 MrPhoenix   Members   

134
Like
0Likes
Like

Posted 02 February 2013 - 06:45 PM

it seems a little glitchy near the top after it repeats



#5 Khatharr   Members   

8642
Like
0Likes
Like

Posted 04 February 2013 - 12:12 PM

<p>Try moving the addition to before the range correction. Otherwise I don't see anything that should be causing bugs.</p>

Edited by Khatharr, 04 February 2013 - 12:13 PM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.