Recent posts by scotty123456789 on Kongregate

Flag Post

Topic: Game Programming / [Q][AS3]Another game still running on New Game

Originally posted by Aesica:
When using removeChild to get rid of something for good, make sure every event listener (frame events, mouse events, etc) tied to it is also removed. Otherwise, they’ll continue to function, and even though it’s not on stage anymore and perhaps no other references to it remain anywhere, stuff is still going to happen.

That makes sense now, thanks for clearing it up for me.

 
Flag Post

Topic: Game Programming / [Q][AS3]Another game still running on New Game

Will removing the instances of objects once the game ends work? Example, removeChild(ball), removeChild(paddle) etc? I can’t just stop the entire game timer because everything runs off of it.

 
Flag Post

Topic: Game Programming / [Q][AS3]Another game still running on New Game

I’m making a pong style game, my problem is whenever a game ends, it has a button which goes back to the main menu. User clicks that, but the game is still running in the back. I found this out by putting some trace statements associated when the ball either hits the left or right side of the screen and the score kept changing after the user went back to the menu.

I understand AS3 for the most part, I just need a general solution to the problem.

removeChild(“objects”) or something?

 
Flag Post

Topic: Game Programming / [Q][AS3]Help with a wheel

Makes sense, got it pictured out in my head now.

Thanks!

 
Flag Post

Topic: Game Programming / [Q][AS3]Help with a wheel

I’m trying to make this wheel which will house different powerups once the player scores, but I’m not really sure how to approach it since I’m a horrible designer. It’s a pong/breakout style game.

How would I go about making a wheel that once the player scores, it spins to a random piece, changes a value in the game (such as add another ball), then continue on?

 
Flag Post

Topic: Game Programming / Trying to Become a Game Dev- Need Help

Agree, start with scratch just to learn the basic of programming. If you want to make games for Kong, ActionScript 3 is probably the best. It’s the first language I learned and it’s helped a lot with others.

Try out ‘The Programmers RPG’ here on Kong. Fun game that will teach you a lot about ActionScript 3, and it’s easy to follow.

 
Flag Post

Topic: Game Programming / [Q][AS3] Menu Screen Structuring

EDIT: Nevermind I found out the problem with this. SumGato pointed out I didn’t put addChild(mainMenu) to the goToMainMenu() function. This fixed it.

 
Flag Post

Topic: Game Programming / [Q][AS3] Menu Screen Structuring

This is my document class that handles menus and such: http://pastebin.com/52T3cgdD

If anyone has suggestions on how I can improve on this, please say so. This is my first game, so I guess I’m considered “novice”, however I do understand programming techniques.

The error occurs when attempting to go back to the main menu once you die in the game. A gameOver screen and mainmenu button appears. Once I click on my mainmenu button I get a null reference error. I debugged it to a line that didn’t have anything to do with it, being a function on my mainMenu class that made CPU’s play a game.

If you need to see other classes, let me know. Also let me know how I could improve upon the class and avoid future mistakes. Thanks.

 
Flag Post

Topic: Game Programming / [Q][AS3] Menu Screen Structuring

Bump. Still looking for help.

 
Flag Post

Topic: Game Programming / [Q][AS3] Menu Screen Structuring

I followed the Avoider Tutorial Method for making my menu system, but I’ve been running into weird error I’m trying to fix.

 
Flag Post

Topic: Game Programming / [Q][AS3] Menu Screen Structuring

I’ve been having a hard time trying to figure out how to structure a menu system. Basically, I only have the MainMenu, which starts different game modes, displays options, displays instructions etc. The game itself, then a PauseMenu and a GameOverMenu, which are both in-game activated menus.

I’d like to make the entire game in two frames, with a preloader in the first, everything else in the second (since I already have the menus and main game in one frame.)

Any tips, links to tutorials, or source codes which could help?

 
Flag Post

Topic: Game Programming / [AS3] Pause Function Problems

Added

 stage.focus = stage; 
So the stage always had focus. Fixed the problem.

 
Flag Post

Topic: Game Programming / [AS3] Pause Function Problems

Partially fixed. Gave the stage focus for each frame and changed to this..

 private function pauseGame()
		{
			stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
			function keyDownHandler(e:KeyboardEvent):void
			{
				if (isPaused == false)
				{
					isPaused = true;
					
					// If "P" Pressed
					if (e.keyCode == 80)
					{
						addChild(pauseMenu);
						pauseMenu.x = 275;
						pauseMenu.y = 200;
						stage.frameRate = 0.01;
					}
				}
				else if (isPaused == true)
				{
					isPaused = false;
				}
			}
		}

But I’m now having a problem where I’ll have my pauseMenu appear only if I move the mouse after I paused the game with “P”. The frameRate == 0.01 though and does pause.

 
Flag Post

Topic: Game Programming / [AS3] Pause Function Problems

I’m having problem with pausing the game. If I do not click inside Flash Player, the game with not pause. If I click inside of Flash Player it will pause with the KEY_DOWN, but if I try again I need to click inside Flash Player to pause. Seems like it’s losing the focus, but I’m not sure. Here’s everything in which involves my pause function…

 pauseGame(); "Called inside of my "tick" function which happens each frame." 
 private function pauseGame()
	{
		stage.addEventListener(KeyboardEvent.KEY_DOWN,
                keyDownHandler);

		function keyDownHandler(e:KeyboardEvent):void
		{
			if (stage.frameRate == 60)
			{
				// If "P" Pressed
				if (e.keyCode == 80)
				{
					addChild(pauseMenu);
					pauseMenu.x = 275;
					pauseMenu.y = 200;
					stage.frameRate = 0.01;
					isPaused = true;
				}
			}
			else if (stage.frameRate != 60)
			{
				if (e.keyCode == 80)
				{
					stage.frameRate = 60;
					isPaused = false;
				}
			}
		}
	} 
“Ignore not having the pauseMenu removed in else if”

Also do I need to call pauseGame() within my onTick function or just in the constructor?

 
Flag Post

Topic: Game Programming / [AS3] Text Format Registration Point

(Assuming it is somehow possible) how do you change the registration point of a Text Format’s Text either within or out of code? It’s set at the upper left hand corner currently and I would like to move it to center.

 
Flag Post

Topic: Game Programming / [AS3] Parameter not working

This worked. Thank you.

 
Flag Post

Topic: Game Programming / [AS3] Parameter not working

Here’s my Main class: http://pastebin.com/qiSsbAMj

As you can see I put in some trace statements to see what came back at the end of the constructor, which works like it should. I added a trace to the tick function and it came back as 0 every time.

Do i need something like?…

 this.gameMode = gameMode

 
Flag Post

Topic: Game Programming / [AS3] Parameter not working

NOTE: gameMode at the end of the constructor, but I put a trace statement at the beginning of my onTick which runs my game and gameMode always == 0, even if it’s 1 or 2 to begin with.

 
Flag Post

Topic: Game Programming / [AS3] Parameter not working

I’m trying to set up different game modes (easy, normal, hard). From the main menu the user selects either of these with one of three buttons. This is a pong style game.

In my main game class I declared

gameMode:int

In my constructor function is set the parameter as…
public function Main(gameMode:int)

On my document class which handles navigating between the screens, I set them to display with…
playScreen = new Main(0);
playScreen.x = 0;
playScreen.y = 0;
addChild( playScreen );

Within the constructor of the main class, I have if statements to tell what will happen in each gameMode…

if (gameMode == 0)
{
ballSpeedX = -3;
ballSpeedY = -2;
}

gameMode integers increase as difficulty increases. Example, gameMode 1 the ballSpeed is multiplied by 2.

Later on in my code when the player’s paddle scores, I have a function that resets the ball to the middle then send it off in x or -x direction. This is within the function for resetting the ball’s speed…

if (gameMode == 0)
{
ballSpeedX = 3;
ballSpeedY = Math.floor(Math.random() * 7) – 3;
}

…with different else if statements for each gameMode integer.

Once I get down to the resetball function, it only does gameMode == 0 and not gameMode == 1 or 2 even if those were selected.

What am I doing wrong? Am I making this to complicated? Anyway to make it simpler?

 
Flag Post

Topic: Game Programming / [AS3] Displaying Text With Code

Quick question, trying to get my text which is an object onto the stage by using code. How would I go about doing so if I want the text to be dynamic and I don’t want to drag it on stage?

 
Flag Post

Topic: Game Programming / Standard for setting up a game in Flash

Adobe flash, yes. I don’t code on the timeline in actions, everything in one layer, one frame, separate class files for each object. I was just curious on how other people do things.

One question I do have though is how to set up different menus with a game. Assuming just make each menu a separate class that does things only in that menu, then use the “main” or “document” class to bring all of them together with events.

 
Flag Post

Topic: Game Programming / Standard for setting up a game in Flash

First off, I’d like to begin with saying I understand most programming concepts, but I only have some experience with AS3.

I know there are many ways to set up class files with your game, but how do most people do it? I can’t seem to find one solid explanation on the best way to set it up.

Previously I created .as files for every object, brought it into the stage with code then continued. If I have learned correctly, should I create a document.as which brings in menus, main, and other part of the game? Any advice helps. If there’s any links that sort of explain this go ahead and link it.

 
Flag Post

Topic: Bloons TD 5 / Earn Kreds

Kongregate will never make a way for users to get free kreds. They have been debating whether to integrate a reward system for years, and nothing has happened. Earning kreds for badge achievements is NOT in Kongregate’s future.

 
Flag Post

Topic: Mob Wars: La Cosa Nostra: General / Syndicate Recruitment Thread

Join CiTe, a traditional family style syndicate that is all about respect. We help lower levels become better players. Recruiting all mobsters, no matter what level you are.

Visit our syndicate page and send a request, or visit our website at citemono.yolasite.com , go to recruitment and fill out a new recruit form. If there is a member in the main chat then talk to them about becoming a member. Thanks!

-DaTallBoy-CiTe~Godfather~

 
Flag Post

Topic: Mob Wars: La Cosa Nostra: General / Syndicate Recruitment Thread

List your syndicate and make it known to the mob world. Please do not spam and only post a syndicate recruitment message every 24 hours.