Recent posts by shank8 on Kongregate

Flag Post

Topic: Game Programming / For Loop being weird

yeah, that use of a for loop automatically iterates the variable i think. but ill try yours. idk how the “i” becomes an object tho. Im just using it as a integer to control a instance of the array

 
Flag Post

Topic: Game Programming / For Loop being weird

i have a For loop that is supposed to be check collision with a player and a number of instances in an array. For some reason when i play the game, the loop seems to not work and sometimes the collision is detected and other times its not. Sometimes it will even change the property i want to change during a collision for more than one object in the array and not just the one that collided. Heres some of the code:

player.onEnterFrame = function(){
	for(i in orbArray)
	{
		if(this.hitTest(orbArray[i])){
			orbArray[i].removeMovieClip();
		}
	}
}
 
Flag Post

Topic: Game Programming / File Reference on Local Disk??

yeah, I was afraid of that, but ok. Thanks a lot

 
Flag Post

Topic: Game Programming / File Reference on Local Disk??

So I am creating a photo viewing program and righjt now i just wanna be able to upload some photos from your local disk and put them in the flash program and be able to show them. I’ve been lookin around on flash about File Reference and I see how to do it with a server. The only thing is, that is meant for uploading the same file everytime you use it. I want the program to upload a different file from different locations on your computer at any time. Any help?

thanks

 
Flag Post

Topic: Game Programming / Strange Problems

oh, haha, brain fart, im looping play(); in a onEnterFrame, thx a lot tho..!!

 
Flag Post

Topic: Game Programming / Problem!!

ok thx alot bigcheese

 
Flag Post

Topic: Game Programming / Strange Problems

I am working on a photo viewing flash program and I have a preloader and some titles and other stuff all located on different scenes. That seemed to be the easiest way to use completely different layers and animations. For some reason, when I finally get to the scene where I want to upload the pictures and everything, when I put stop(); in the frame the movie just keeps playing and never stops. stop(); usually works fine when i make movies without multiple scenes, but for some reason it isn’t this time.

Any Help?

Thanks

 
Flag Post

Topic: Game Programming / Problem!!

Does anyone know why this won’t work. It creates the orb, but does not do the this._y -= 5 part. I’m not sure how to create multiple instances of the orb and control them all with the same code:


createOrb = function(){
pickOrb = random(3)+1;

if(pickOrb == 1)
{
root.createEmptyMovieClip(“orb”,this.getNextHighestDepth());
orb.attachMovie(“fire_orb”,“newfireorb”,this.getNextHighestDepth());
orb.x = tower._x;
orb.
y = tower.
y;
}
if(pickOrb == 2)
{
root.createEmptyMovieClip(“orb”,this.getNextHighestDepth());
orb.attachMovie(“ice_orb”,“newiceorb”,this.getNextHighestDepth());
orb.x = tower._x;
orb.
y = tower.
y;
}
if(pickOrb == 3)
{
root.createEmptyMovieClip(“orb”,this.getNextHighestDepth());
orb.attachMovie(“poison_orb”,“newpoisonorb”,this.getNextHighestDepth());
orb.x = tower.x;
orb.
y = tower.
y;
}
}
orb.onEnterFrame = function(){
this.
y -= 5;
}

 
Flag Post

Topic: Game Programming / Masking problem

So, im kinda a beginner programmer. Ive just taught myself and I havent really programmed in a while is Flash so im not sure what Im doing wrong, but this is what I got.

Ive created a few frames and layers and each one is a different asset of the game. One is preloader, one menu, one game…ect. And on the preloader i have a MC called preloader and I use AS to mask some txt over a black rectangle. Then when the loaded bytes percentage goes up. It gotoAndStop(percentage) of the preloader MC. but for some reason the mask doesnt work and when i simulate the download, the black rectangle is visible. Not sure what i did wrong, but when i just double click on the MC and play the masking animation without the simulation, it works perfect…

Sorry if its hard to understand. hard to explain this

Thanks

 
Flag Post

Topic: Game Programming / Best place to post .fla files for reference

k thx

 
Flag Post

Topic: Game Programming / Best place to post .fla files for reference

I want to show people on the forums on Kong my .fla file for a game I am having trouble with, but i dont know what website I should use to upload the .fla and make it available for download. Is there a forum or something that I can do this easily? Thx

 
Flag Post

Topic: Game Programming / Coding Help for Menus!!!

omg, does noone actually read what was said???

 
Flag Post

Topic: Game Programming / Coding Help for Menus!!!

I did, thats the problem, as soon as I added the preloader and menus the game started crashing and weird things happened

 
Flag Post

Topic: Game Programming / Coding Help for Menus!!!

I dont think its that cause my game is really small and only has like 20 movieclips. It just seems that when i added some frames with code before the game, it started doing this… any other suggestions?

 
Flag Post

Topic: Game Programming / Coding Help for Menus!!!

Ok, so I had a perfectly coded game that had no problems in it really, and I just added a Menu onto the Movie and now when I go to the frame with the game all my loops are like not ending, movieclips with animation inside them are just always playing and weird things are happening. Ive seen this setup for games with menus before but Im not sure if It is right.

I have 6 Frames:

One frame for a preloader, one blank one with all my mcs, sounds, etc. for loading, one for the menu, one for the options, one for instructions, and one for the actually game and all the game code.

Now I thought this would work If I just do a gotoAndStop(6); to go to the game or w/e when I press the “Play” button, but then all this weird stuff is happening.

Does anyone know how I can better set this up or what the problem is??

Thanks

 
Flag Post

Topic: Game Programming / Arrays?? with MCs

http://www.kongregate.com/games/shank8/test-for-rapid-fire

 
Flag Post

Topic: Game Programming / Arrays?? with MCs

ok so now I figured that part out, but I have one other thing going on. When I collect the coins( there are 5 for level 1), I am doing level++; and sending the var level to the setCoins function where I use a loop to place my coins on the screen. But whats happening is, the code sets the coins out on the stage but for some reason my code for collision detection only checks for 5 of the coins, when, if I am in level 2, there are really 10 coins on the stage. Ill upload the swf and give you the code:

checkCoins = function()
{
	
	for(i=0;i<totalCoins;i++)
	{
	if(myCoins[i].hitTest(_root.ball.square))
	{
		myCoins[i].removeMovieClip();
		_root.score+=500;
		numCoins--;
		if(numCoins == 0)
	{
		level++;
		setCoins(level);
	}
	}
	}
}

function setCoins(level:Number){
	totalCoins = (level*5);
	numCoins = totalCoins;
	do{
	coin = attachMovie("coin","newcoin"+j,this.getNextHighestDepth());
	j++;
	myCoins.push(coin);
	coin._x = (random(475)+20);
	coin._y = (random(475)+20);
	}while(j < totalCoins);
	
}

This is only a fraction of my code, but this is where I think the error is. Thx alot: down below is the link to the swf.

 
Flag Post

Topic: Game Programming / Arrays?? with MCs

ok, so I know that the collision code works, but how do you create a loop to check for collisions without looping forever and causing the script to abort??

 
Flag Post

Topic: Game Programming / Arrays?? with MCs

ok thx, but yeah for some reason this isnt working for what I want it to do. Ill keep looking at it thought

 
Flag Post

Topic: Game Programming / Arrays?? with MCs

Im wondering if this code will work:


var myCoins:Array = new Array();//create Array that I am adding a MC called coin to in another layer
var i:Number = 0;
do
{
if(myCoins[i].hitTest(ball.square))//When the certain coin on the stage hits the ball
{
myCoins[i]._visible = 0;//use visible to test if the collision works
}
}while(i<(myCoins.length-2));//I think this is right, I want to just run the loop from 0 to the number of coins out on the stage
if(i == (myCoins.length-1))//When the loops gets out I want to run it again
{
i = 0;
}

Thanks

 
Flag Post

Topic: Game Programming / Creating Particle Bursts?

Hey, so in that past month I have been trying to create some complex games with class and all that, but I just not really getting that so Im trying to get together a simple physics based game. The only thing is I would like it to look better by adding some particle effects based on collision. It doesn’t have to be perfect, but just some cool little particle burst when 2 objects collide. So far I have a ball on the screen and I am using AS2 to set up a physics environment with gravity and friction. The player then uses the arrow keys to control the ball. I have set up 4 walls around the edges of the movie with AS and the ball bounces of the walls when it hits the wall. So pretty much, I just want to create a particle effect when I collide with the wall.

Im using a makeshift collision detection process where I have a spinning square in the ball MC and I check the collision with the square. It works pretty good so. Thx alot.

Shank

 
Flag Post

Topic: Game Programming / Options? Classes or Arrays??

oh yeah, forgot about that sticky, thx, ill take a look.

 
Flag Post

Topic: Game Programming / Options? Classes or Arrays??

hey, so I always get this far into making a game and then can’t find a good way to do this. So this is the code I have for one function that in the game there is a _mc that is a big circle and when the function is called, the mc is placed on the screen at the mouse and then I want it to do all of the other things like hitTests and everything, but what I am stuck on is how to make all this into a class or something.

This code is example for what I want, except I want to be able to have more than one of these gHeal mcs out on the screen at once and for each of them to have their own cordinates, timer, hitTest, etc. I know you need to use classes for this, but I dont know how to do that. Can someone please show me how or show me a good tutorial on using classes in games??

Thx


groupHealtimer = 0;
knightHealth = 20;
function startGroupHeal()
{
var gHeal = attachMovie(“gHeal”,“newgHeal”,this.getNextHighestDepth());
gHeal._x = xmouse;
gHeal.
y = _ymouse;
gHeal.onEnterFrame = function(){
if(gHeal.hitTest(knight))
{
knightHealth = .2;
}
groupHealtimer
+;
if(groupHealtimer > 150){
gHeal.removeMovieClip();
}
}
}

 
Flag Post

Topic: Game Programming / Using multiple cursors

ok thx alot guys, Arcane’s method sounds obviously the best, so ill try that.

Also, if I did that, do I have to create the MC on stage and then create frames or is it possible to create an MC with AS and then create frames in it to store other mcs

 
Flag Post

Topic: Game Programming / Using multiple cursors

Im trying to create a game with different powers in game and each one has a different cursor. How would you guys go about doing this. My idea was to create a var that holds a mc with is brought to the screen with attachMovie and then startDrag with it, but when I try to transition from one cursor to then next, the old mc is left on the stage even though Im trying to use mc.removeMovieClip() to remove it. The cursors are chosen by the number Keys 1-5. Thx

Code so far:

startDrag("main_mouse",true);
Mouse.hide();
updateAfterEvent();
menu.basicHeal_icon.enabled = 0;
menu.basicHeal_icon._alpha = 40;
menu.healthBuff_icon.enabled = 0;
menu.healthBuff_icon._alpha = 40;
menu.reloadBuff_icon.enabled = 0;
menu.reloadBuff_icon._alpha = 40;
menu.groupHeal_icon.enabled = 0;
menu.groupHeal_icon._alpha = 40;
menu.regen_icon.enabled = 0;
menu.regen_icon._alpha = 40;
var powerNumber = 0;
var playerXP = 0;
var powerKey:Object = new Object();
function checkXP()
{
	if(playerXP >= 0)
	{
		menu.basicHeal_icon.enabled = 1;
		menu.basicHeal_icon._alpha = 100;
	}
	if(playerXP >= 50)
	{
		menu.healthBuff_icon.enabled = 1;
		menu.healthBuff_icon._alpha = 100;
	}
	if(playerXP >= 150)
	{
		menu.reloadBuff_icon.enabled = 1;
		menu.reloadBuff_icon._alpha = 100;
	}
	if(playerXP >= 300)
	{
		menu.regen_icon.enabled = 1;
		menu.regen_icon._alpha = 100;
	}
	if(playerXP >= 500)
	{
		menu.groupHeal_icon.enabled = 1;
		menu.groupHeal_icon._alpha = 100;
	}
}
onEnterFrame = function()
{
	txt = powerNumber;
	checkXP();
}
powerKey.onKeyDown = function()
{
	
	if(Key.getAscii()==49){
		if(menu.basicHeal_icon.enabled == 1 && powerNumber != 1)
		{
		powerNumber = 1;
		checkMouse();
		menu.basicHeal_icon.play();
		}
	};
	if(Key.getAscii()==50){
		if(menu.healthBuff_icon.enabled == 1)
		{
		powerNumber = 2;
		checkMouse();
		menu.healthBuff_icon.play();
		}
	};
	if(Key.getAscii()==51){
		if(menu.reloadBuff_icon.enabled == 1)
		{
		powerNumber = 3;
		checkMouse();
		menu.reloadBuff_icon.play();
		}
	};
	if(Key.getAscii()==52){
		if(menu.regen_icon.enabled == 1)
		{
		powerNumber = 4;
		checkMouse();
		menu.regen_icon.play();
		}
	};
	if(Key.getAscii()==53){
		if(menu.groupHeal_icon.enabled == 1)
		{
		powerNumber = 5;
		checkMouse();
		menu.groupHeal_icon.play();
		}
	};
	
}


function checkMouse()
{
	specialMouse.removeMovieClip();
	main_mouse.removeMovieClip();
	if(powerNumber == 1)
	{
	var specialMouse:MovieClip = attachMovie("basicHealth_mouse","newbaseHealth_mouse",this.getNextHighestDepth());
	specialMouse.startDrag(true);
	}
}

Key.addListener(powerKey);