Recent posts by Levgre on Kongregate

Flag Post

Topic: Game Design / What makes a great idle game?

I may design an idle game after my current strategy game project

Here are a few things, in my view, which enhance an idle game yet I haven’t seen utilized yet.

1. Different strategy paths

While a player is supposed to be able to be idle, that doesn’t mean everyone should have to go the same route.

I.E., if you had a civilization based idle game, a player could develop farming, trade, military, exploration, diplomacy, so on. Not only does it make the game seem deeper, it even allows fulfilling multiple play throughs.

2. A sense of progress/growth

In many idle games, early on it seems you are growing stronger and gaining more capabilities, while later on you get just one nearly identical buff after another. There are many ways to work around this, 1: upgrades don’t just add numbers, but add new ‘tools’, some of which give brand new capabilities (either replacing an upgrade path, or unlocking a new one).

I.E. If it was a civilization idle, when you reach a high enough farming level, you can start to develop urban areas. When you build ocean-worthy ships, the amount of exploration open to the player expands greatly.

 
Flag Post

Topic: Game Programming / Ideas for coding a really big random event system?

In my turn based strategy game, I plan to have at least 100-150 unique random events, if not a lot more (like 200-300).

So is the best way just a sort of terraced if else sequence?

I.E.

If eventFactor <=10

if eventFactor == 1

else if eventFactor == 2

etc. etc.

else if Eventfactor <=20

if eventFactor == 11

else if eventFactor == 12

etc.

The events aren’t simple enough to really have generalized generation, each has to be unique (although some of the events will further break down into random settings)

Is a terraced if else if system a good way to go about it?

 
Flag Post

Topic: Game Programming / Looking for advice for programming loot system

I would say 50 at a minimum, 70+ is quite possible, 100+ is not out of the question.

Could be something like
10 ranged weapons
10 melee weapons
10 armors
10 miscellaneous gear
10 base enhancing items
10 supply items
10 vehicle items
so on..

 
Flag Post

Topic: Game Programming / Looking for advice for programming loot system

In my strategy game, each zone of the map (there are 40 or so), will have custom loot.

Here are several ways I’ve thought to do it.

Loot arrays with 20+ elements for each zone, each being a loot item/small category (code may then add some randomness, such as quality)

Loot arrays with references to large categories, and then code chooses a specific item from those categories. This would reduce array length to maybe 4-10.

So basically, it seems to be picking a balance point between pre-set arrays determining the loot, and code determining the loot. My guess is larger arrays and less code would be less demanding. All the loot calculations will be done in one go, at end of turn. Or I suppose I could pre-set the ‘next loots’ mid-turn, when a player decides to go to a zone (they can go to multiple zones in one turn).

This is my first time making a random loot system, so any advice would be useful, especially letting me know if either a larger array system or larger logic sequence is ‘inferior’ or flawed :p.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

missionDisplay = the large white box.
memberBox = the 3 connected squares the bottom of missionDisplay. One movieClip.
Xbutton = the X in the corner of missionDisplay.

missionStart is the only function where these objects are added. All 3 objects , missionDisplay, xButton, and memberBox, are all instantiated identically, in the constructor. The code for these classes is identical.

There is no ‘mystery shape object’, my only guess is the disappearing object is missionDisplay. That’s strange though, since missionDisplay is obviously not a child of itself. It is added to stage, then the other 2 objects are added to missionDisplay.

If instead of using that while loop, I write
missionDisplay.addChild(memberBox)
missionDisplay.addChild(xButton)
Everything works completely fine when I run missionStart the 1st time, and every other time.

So, the problem must not be how I am adding/removing, OTHER than in that while statement. It is making missionDisplay unable to be shown, although it still exists, obviously. The other 2 objects are still being added to it, at the proper X-Y locations. It still is placed in the display list for the stage.

teamMenu(no current issues) is in the upper left corner.
The smiley faces are portraits of teamMember. As you see, there are two blue smileys, although they are different classes. By clicking on a character’s portraitA in the teamMenu, their portraitB is added to the memberBox. The while statement makes memberBox permanently disappear, also, even if I can still add portraitB instances to it.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

The first time, the 2 children of missionDisplay (memberBox and xButton) have index 1 and 2. After I remove everything and add them again, their indexes are one less, 0 and 1.

the index of huntDisplay is constant, it is at index 4 (of the stage) the first time, and 4 the second time.

The first time, the object for missionDisplay.getChildAt(0); is [object Shape]. The 2nd time, it is object xButton).

So it seems that it might be with how the huntDisplay object is instantiated in the code… I Guess I’ll review that. It’s like its serving a dual role as parent and child, but when I tried getChildIndex for it, it generated an error (as it wasn’t a child).

Or just being made a parent ‘changes’ it in some way…

I’m also looking at the properties of each object, they all seem to be movieClips with no differences, don’t see it yet though. It seems the issue is the while statement. I can add/remove things without issue, as long as I don’t use that while (or for) statement.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

Yup, teamMenu is indeed removed in different code, and they don’t overlap on the screen, either. teamMenu is just a smaller menu on the side.

I also tried that alternative for statement, same issue happened. Gonna read through the the relevant chapters in Essential ActionScript 3.0 book again..

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

The background ‘is’ missionDisplay, itself. It is the parent I’m adding children too.

Regardless, removing missionDisplay and all its children shouldn’t make it permanently invisible from then on… from what I know. (setting it as visible does not help, it just cannot be seen).

What could make it permanently not-visible?

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

Some of the stuff has to come and go, although not all of it. I could make logic statements to take out specific children, or I could just take all the children out of these menus, then re-add whichever ones are needed later. I’m not sure what I’ll end up doing, but from what I can tell this ‘should’ work.

I don’t like giving up on solving something, even if I redesign the code for missionMenu, I believe I’ll remove/re-add all children elsewhere(like memberBox, which uses a similar while loop, and has the same issue). Thanks for the suggestions, but I’m looking for technical help. It seems I’m missing something here, with that while loop.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

I read that visible can be more resource intensive… I would be happy to use it over remove/add where I could. My game is going to be pretty big, with at least half a dozen menus.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

I removed everything piece by piece, the problem code is here

while (missionDisplay.numChildren > 0)
			{
             missionDisplay.removeChildAt(0);
			}

I read in a book this would work, I guess it doesn’t work correctly here.

If I specifically say missionDisplay.removeChild(memberBox), etc., it causes no issues, so it is the while statement.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?

That’s how it was before. I tried to fix it (or at least figure out what was wrong more easily) by putting everything within the same class.

So I tried that already, and this problem still occured.

The missionDisplay itself ‘is’ the background.

 
Flag Post

Topic: Game Programming / AddChild... RemoveChild... Addchild... can't get object to front?


public function missionStart()
		{	
			addChild(missionDisplay);
			//addChildAt(missionDisplay,numChildren);
			missionDisplay.addChild(xOut);
			xButton.x = 365;
			xButton.y = 2;
			missionDisplay.addChild(memberBox);
			memberBox.x = 15;
		        memberrBox.y = 280;
	            xButton.addEventListener(MouseEvent.CLICK,closeMissionMenu);
			var i = 0;
			addChild(teamMenu);
			huntDisplay.x = 80;
			huntDisplay.y = 25;
			trace(getChildIndex(teamMenu));
			trace(getChildIndex(MissionDisplay));
			

			for each (var item:portraitB in activeZone.missionTeam)
			{
			item.x = i;
			i =+ 45;
			}
			
			for each (var item2:portraitA in teamArray)
			{
			item2.addEventListener(MouseEvent.CLICK, addToTeam);			
			}
		}


		public function closeMissionMenu(e:MouseEvent)
		{
			while (missionDisplay.numChildren > 0)
			{
             missionDisplay.removeChildAt(0);
			}
			
			while (memberBox.numChildren > 0)
			{
             memberBox.removeChildAt(0);
			}
			removeChild(missionDisplay);
			closeMissionMenu();
		}

I get the same trace output for in both cases, but the 2nd time I add missionDisplay I can’t see it.

trace(getChildIndex(teamMenu)); = 5
trace(getChildIndex(MissionDisplay)); = 4

Here’s the before and after pictures

first time I open the mission menu, missionStart()

After closeMissionMenu() executes, then missionStart() executes again

xButton is being placed properly, on the top right. So is memberBox, which holds the smiley face… except you cant see the box outlines. missionDisplay is completely invisible. I want it to look the same, each time.

 
Flag Post

Topic: Game Programming / How to refer to 'parent object' of an instance variable?

Hm I’m not sure how that would solve referencing the parent class from the instance variable.

But I think I found a good solution?

In the teamMember class, I added

memberA.parentMember = this;

So now I can reference the class memberA is in, with memberA.parentMember. It seemed to have worked, so far..

 
Flag Post

Topic: Game Programming / How to refer to 'parent object' of an instance variable?

I have different ‘teamMember’ classes which adds a movieclip portrait, say ‘memberPortrait’.

So teamMember1.memberPortrait, teamMember2.memberPortrait, etc.

I need to add an eventListener to ‘memberPortrait’ which will dynamically call up the teamMember it belongs to, so I can then make that teamMember do something else.

For example…


teamMember1.memberPortrait.addEventListener(MouseEvent.CLICK, addToTeam);
public function addToTeam(e:MouseEvent):void
{
var activeTeamMember= e.currentTarget.parent;
stage.addChild(activeTeamMember.memberPortrait2);
}

e.currentTarget.parent is the line I’m concerned with… I’m trying to refer to the object that contains the e.currentTarget.

 
Flag Post

Topic: Game Programming / Is there a way to assign an image to a MovieClip through code?

Okay, so I’ll describe what I need to do. Characters in my game (each a unique class) will need their image displayed in a variety of menus. Yet each image must link to that character’s profile.

I wanted to make the images for all the different characters the same class type, and after creating an instance I’d assign whatever image I needed. So I wouldn’t have to make 3 sprite/movieclip classes for each character.

So, would I be able to have 3 frames for each character, display those frames, and add event listeners to them?

I guess I’ll study up on frames.

 
Flag Post

Topic: Game Programming / Is there a way to assign an image to a MovieClip through code?

I mean, instead of using the image attached to it in the library… assign a new image to it?

 
Flag Post

Topic: Game Programming / 1119 Access of possibly undefined property _ through a reference with static type _

Actually, you read the situation wrong here, Ace_Blue. For one, these are probably placeholder names for when I narrow down what variables/classes I need. They are meaningful and link in my mind how these objects are related. They don’t confuse me. My convention and what clicks for me obviously differs from you.

What I did wrong here is I added a variable named memberA to each descendent of TeamMember(TeamMemberA and TeamMember B). Instead I need to work top down and instantiate in the super, so the code has a guarantee that a given variable memberA will exist.

There was something I did not understand, and from this thread and the helpful responses I learned what it was. It wasn’t a naming issue. In the future I will explain my class structure more clearly.

 
Flag Post

Topic: Game Programming / 1119 Access of possibly undefined property _ through a reference with static type _

Sorry slipped my mind, added the exact error message.

 
Flag Post

Topic: Game Programming / 1119 Access of possibly undefined property _ through a reference with static type _

The access is internal when you don’t specify. So the other class is in the same package, and should have access.

However I tried adding public, and the same error occurs.

 
Flag Post

Topic: Game Programming / 1119 Access of possibly undefined property _ through a reference with static type _

Line 133 1119: Access of possibly undefined property memberA through a reference with static type TeamMember.

This error has been plaguing me a ton. There is obviously something I am missing here. I have been trying to reference variables from one class inside another class. I might also have some redundant code I added trying to fix it… but I’ve never changed the error.

here is where the error emerges


public class Main extends MovieClip
{
.....
public function openTeamMenu()
		{
			addChild(teamMenu); 
			for each (var tmember:TeamMember in teamArray) {
			teamMenu.addChild(tmember.memberA);//This is the line with the error

Here’s the tmember class I’m referring to



package  {
	
	import flash.display.MovieClip;
	
	
	public class TeamMember1 extends TeamMember {
		 var memberA:Member1A;
		 var memberB:Member1B;
		
		public function TeamMember1() {

                memberA = new Member1A;
                memberB = new Member1B;
			
		}
	}
	
}

When I place the ‘teamMenu.addChild(tmember.memberA);’ outside of the loop, it works. So it seems to be array related… time to google more.

 
Flag Post

Topic: Game Programming / Having one object in multiple places at once

I did do blitting in one game tutorial book. That was a couple months ago. So would I have a sheet of images which I would draw into regions? But would those images have any functionality, like event listening? How would you use blitting in this situation?

Thanks for any help.

 
Flag Post

Topic: Game Programming / Having one object in multiple places at once

In my strategy game, there are unique team members I want to have in multiple windows/places at once. Here are pictures explaining.

The green and white smiley are currently in teamMenu, which the player summoned.

I want, when those teammates are clicked on, for them to be transferred to the missionMenu, like below.

However, I want the team member to remain in the teamMenu, although greyed out to show they are currently occupied with something. Clicking on the team member in either place needs to bring up their profile.

So I know addChild won’t work, as that just changes where it is displayed. Should I make several images in the teamMember classes, which it can distribute as needed? I want to do this the right way, no clue what that way is, though.

 
Flag Post

Topic: Game Programming / I cannot get my package names right..

No, Main is my document class, but generates the same error

package zombiebeta {

public class Main extends MovieClip
{

C:\source\projects\zombiebeta\Main.as, Line 1
5001: The name of package ‘zombiebeta’ does not reflect the location of this file. Please change the package definition’s name inside this file, or move the file. C:\source\projects\zombiebeta\Main.as

I have the source path for both actionscript settings and the project set to C:/source/projects

The only way I avoid these errors is having just package{

 
Flag Post

Topic: Game Programming / I cannot get my package names right..

So I have the folder set up as such… with Flash IDE

C:/source/projects/zombiebeta

Then I have the source path, in Actionscript settings, set to

C:/source/projects

So then, I set the package for my classes to

package zombiebeta
{
import….

But I get the error

C:\source\projects\zombiebeta\Zone.as, Line 1
5001: The name of package ‘zombiebeta’ does not reflect the location of this file. Please change the package definition’s name inside this file, or move the file. C:\source\projects\zombiebeta\Zone.as

I’ve tried following instructions from several books, and from what I can tell this should work. But I’m obviously doing something wrong..

Getting packages right has been harder than anything else I’ve learned so far. I have no idea why. I do think these books do a crappy job of explaining it..