Recent posts by Salvator on Kongregate

Flag Post

Topic: Game Programming / [AS3] Shrink textbox...

Look up autosize, it will autosize according to string length. Or you could measure the length of the strength and have the textbox be set to x+(y*chars). There is also a way to turn wrapping of, you can all find it in the livedocs I believe.

 
Flag Post

Topic: Game Programming / How do you do?

Originally posted by skyboy:
Originally posted by darkscanner:

If so, he probably turned thirteen recently.

who cares? stop mentioning whether or not you think people are underaged or just quit posting on the forum. :)

edit: included a “:)” to make post more positive

Wow that smiley face makes a big difference somehow.

 
Flag Post

Topic: Game Programming / Watch Jiggmin live

Originally posted by Draco18s:


Heisenbugs change form as you attempt to study them.

on the inverse, i had attempted to fix some bugs that only occur in the presence of debugging code yet don’t exist in release.

Ha! great name. The strangest bug I ever had was when I coded a robot for RoboCode, It would sometimes compile without any problems, and sometimes, after changing legit code into new legit code or just running on a different computer it would throw some strange errors. The errors could be fixed by (get your fingers ready to type GTFO) changing print statements into random other print statement. No strange characters or anything, sometimes I would go back and forth between changes and one permutation would work on one computer but not on the other and vise versa. How would you call that?

 
Flag Post

Topic: Game Programming / 3D array tracing problem

Originally posted by Vara:

Well, you could try this function I just wrote (didn’t test is excesively). I don’t know if there is a build-in flash function, but you could use this:

var myArray:Array = [[0,[1,2],3]];

function stringArray(array:Array):String {
	var returnString:String = "[";
	var arrayLength:int = array.length;
	var currentElement:Object;
	for(var i:int=0;i<arrayLength;i++) {
		currentElement = array[i];
		if(currentElement is Array) {
			returnString += stringArray(currentElement as Array);
		} else {
			returnString += String(currentElement);
		}
		if(i+1 != arrayLength) {
			returnString += ",";
		}
	}
	return returnString+"]";
}

trace(stringArray(myArray));

Ah yes of course, trace the string in the array after it’s completely been formed and then add ‘[’ for levels. If I hadn’t been so involved in all this nesting I would’ve thought of that myself, thanks.

 
Flag Post

Topic: Game Programming / 3D array tracing problem

Originally posted by Draco18s:

Step 1:
Use a loop
Step 2:
Use a second loop
Step 3:
Use a third loop

Umm… I’ve created the 3D array and it contains exactly the right elements. What I want to know is if theyre nested right. Trace cannot tell me this because it doesn’t show brackets.

I just read my first post and realise that wasn’t clear.

One of the problems is theres some random comma’s with nothing in between in my trace. This means that i’m creating too many empty arrays at some level and I need to know at which nesting level exactly. If I could trace ‘[’s I would know at what level.

 
Flag Post

Topic: Game Programming / 3D array tracing problem

Everytime I work with 3D arrays It’s really testing my brainpower. Usually I can still manage and it doesn’t cause me too much trouble. But right now I’m creating a 3D array with textelements and the way the array is being filled changes according to the text I’m analysing.

I’ve tried to make a model of the 3D array I have successfully created by writing out the trace and than editing in ‘[’ and ‘]’ because the only thing trace gives me is a list of elements divided by ‘,’s.

Is there a way to modify my trace so that it will write the output like so:

 array contains: [[element0,[element1.0, element1.1],element2]] 

Bcause I need to know if the model I wrote myself is equal to the model flash creates.

Ps. in Java I would print.SystemOut a ‘[’ everytime it went deeper in the array but thats not doable here because 1. I’m tracing other stuff in between like elements found and 2. trace always creates a new line of text instead of adding to the last trace.

 
Flag Post

Topic: Game Programming / Flash Player 11 "Molehill" preview release available for download

Originally posted by UnknownGuardian:

Anyways, I’ve got an Away3D demo build up and running. 17,000 polygons with dynamic lighting at ~40fps

Yeah? well ’ve got 3 polygons running around in the dark at 10fps and your polys will never see them coming!

 
Flag Post

Topic: Game Programming / Curious About Original Work

Originally posted by Devilkan:

Yea I’m more/less doing a skin of Settler’s of Catan, but I’m working on some minor features that aren’t present in the board game. The only thing that I was worried about was that there have been Catan video games, but it seems like most aren’t played anymore or have been discontinued. I obviously will be acknowledging that it is based of Settlers, but I think I may put some more work into making it a little more different.

Thanks for all the great advice!

Wow that sounds like a big project… I’d like to see it when it’s done, even if you don’t consider it a succes.

 
Flag Post

Topic: Game Programming / Game Design is an Art

My translation was sound though. I’ll write out the logic in natural language if that helps.
I’ll use numbers to represent your statements, and letters to represent derived facts
(2)Most games are like pacman. Therefore (A)Pacman is like most games. (“Like” is commutative)

(3)Good games have the property that they are unlike most games. Therefore (B)Games that are like most games cannot be good games.

(A)Pacman is like most games, and (B) Games that are like most games cannot be good games. Therefore ©Pacman cannot be a good game.

By your second axiom, a game cannot be part of the group “good games” and the group “like most games.” The locical courses of action you could take:
-Acknowledge the mistake in your logic or communication and correct it
-Decide that you think pacman is a bad game
-Point out a flaw in my logic (I don’t think there are any here)

I’ll try again. A circle is just like a square in that they are both (geometrical) figures. Even if you have two coins that share many properties and are indistinguishable there is still one difference: Coin A != Coin B.
In this case Pacman was the original so it does matter that only Pacman is exactly like Pacman.
The point being made that most games are just ripoffs of Pacman and are for that reason not “good”. Of course this point has to be derived and you could just as easily arrive at your conclusion. Note how I never said you were wrong.

Btw how’s that essay coming along?

 
Flag Post

Topic: Game Programming / Game Design is an Art

1. Pacman is a game. It is stated that it is common.
2. Most games have the property that they are just like pacman
3. There are good games, they have the property that they are unlike most games.

Pacman can still be part of the last group. Analyzing natural language and then translating it into propositional logic is difficult. Pacman isn’t just like pacman, Pacman == Pacman. Most games are not.

 
Flag Post

Topic: Game Programming / Two quick questions

Originally posted by Rameares:
Originally posted by NineFiveThree:

handle key inputs separately outside of your player class.

definatly follow this bit of advice key events will be passed to what ever object has focus at that time so two seperate objects can’t be recieving key presses at the same time. I assume if you add the listener to the stage the event will propegate up to the stage then you can send it to the instances of your classes. Unless your working with flex and extend the UIComponent it seems to be quit mess to set the focus via code.

I recently got a book on advanced as3 flash design and I read that (having one class with EnterFrame updating all positions and checking collisions) is the best. It’s amazing how much experience you can have coding and how many thinks you can still be doing wrong…

 
Flag Post

Topic: Game Programming / Two quick questions

Originally posted by BobTheCoolGuy:

You could just pass a stage reference to you player class and add the keylisteners to that

Thanks, haven’t used that before, always added an object of my classes to the stage.

 
Flag Post

Topic: Game Programming / Two quick questions

Originally posted by Eu_Plon_Ka:

Peronally, I put my key listeners on the timeline, then pass the needed information to the class that needs keyboard information.

What is this “timeline” you speak of?

 
Flag Post

Topic: Game Programming / Two quick questions

Originally posted by Senekis93:

For the second question, on the test screen, Control > Dissable hotkeys.

Thanks :) Was hoping for an option I could set once and be rid of but this is faster than my current alternative.

 
Flag Post

Topic: Game Programming / Two quick questions

First:
I have different types of players for different game modes. I thought it might be a good idea to extend them both from one Player class that has stuff like key listeners. Problem is, key listeners only work if you put them on an object thats on the stage. If I create an empty Mc Player and add that to this stage, would that be the bet way to go or is there a way around this?

Second:
I’ve noticed that when I testrun a game in Flash and press keys like “a” it will treat it as a shortkey for switching to a different flash drawing tool like “Bone tool” or “Eraser tool”. Because of that I now compile in flash and then run the swf from outside flash. Is there a way to quickly turn shortkeys off (and back on again)? I don’t remember having this problem before and I’ve used this version of Flash (CS4) for at least a year now.

 
Flag Post

Topic: Game Programming / [SOLVED]Interpret String as code AS3

Couldn’t get ExternalInterface to work for some reason (even tried writing a function in pure javascript and injecting it into my as3 script). Couldn’t get D.eval to work because it’s only supported by CS3 (apparently because of a simple problem that would be easy to fix but it hasn’t been done yet). So I used a class I found online which is a lightweight function that solves basic sums (including sums with “(”) that is easy enough to understand for me to add things to it.

Thanks for all the input :)

SOLVED

 
Flag Post

Topic: Game Programming / [SOLVED]Interpret String as code AS3

@UnknownFuryNG

Somebody already pointed that out to me irl. I know see how much faster some of my projects could have been finished using other peoples code. But it still feels “wrong”

@skyboy
Holy shit…. that has to be some of the most complicated code I’ve ever seen. I bet I could learn a lot from it if I could ever read it. Since I can’t read (most of it) I won’t use it.

 
Flag Post

Topic: Game Programming / [SOLVED]Interpret String as code AS3

Originally posted by Wordblind:

Let me first point out that eval() is evil, and you should not use it under any circumstance.

That being said, you may need to use ExternalInterface at some point. The important thing to remember is that call is used to call an existing function, not to execute arbitrary code. (If you could do that, why would you need eval().) When something doesn’t work, you should always read the documentation.

I would really suggest going with method #2. If you don’t want to use prewritten code, write your own—it’s something that every programmer should do once.

From your link, ahem: There are a few scenarios in which eval is invaluable. For example, when you are building up complex mathematical expressions based on user input,

And it’s not arbitrary code, it’s a built in function not supported in AS3

Originally posted by Draco18s:

1. If you put a string between [], it will be interpreted as code, turns out I can’t get that to work as it only seems to work for one argument.

No, that isn’t true. What this code does:

var i = 9;
_root.["object"+i]

is concatenate the string “object” with the variable i (as a string) into “object9” and then find a child of _root by that name, same as if you had typed:

_root.object9

What it allows for is for i to be dynamic and used in a loop.

Yeah I know that sorry I messed up my statement there. Point was that it didn’t do what I wanted it to do.

I’m probably gonna go for option 3 if I can figure it out. I don’t like using other peoples code and since this is a small project, writing a huge Eval function would eat up too much of my time. So this problem is UNSOLVED for the moment.

 
Flag Post

Topic: Game Programming / [SOLVED]Interpret String as code AS3

I want to read a String as if it was code. I want a string like “17+54” to be read so that I could store the result of that calculation in a variable.

I searched around and came up with three ways to do just that:

1. If you put a string between [], it will be interpreted as code, turns out I can’t get that to work as it only seems to work for one argument.

2. Use the code of somebody who went through the trouble of writing a huge function that escapes caracters and whatnot and does the work for me. I don’t like using other peoples code but if this is the fastest way, Ill do it.

3. Use ExternalInterface.call to call Java’s eval() function which should do exactly what I want it to do. I’ve tried calling on Java’s eval function like this:

var temp = "17+5";
myResult = ExternalInterface.call("function(){return eval(\""+temp+"\");}");

But that always results in myResult == 0;

I feel like I’m close here, anybody see what I’m doing wrong? I’ve imported the following package at the top of my class import flash.external.ExternalInterface;

 
Flag Post

Topic: Game Programming / Unity Graphics

Originally posted by ehaugw:

I’m only using Mac…

We all need to start somewhere.

 
Flag Post

Topic: Game Programming / [SOLVED]Advanced hitTesting (AS3)

Actually, I’m content with the way it works now. I made a seperate class for CollisionHelpers and all that class does is add its object to parent.objecthelpers which is an array. I like this solution because I can add countless more collisionhelpers to other objects and the code will still work properly.

Anyway I’ll leave this here in case someone might need it.

 
Flag Post

Topic: Game Programming / [SOLVED]Advanced hitTesting (AS3)

So once again I am faced with the problem of precise, but at the same time low cost, hitTesting.

My problem:
My game is all about hittesting. I’ve got irregular shapes flying across the screen and want to hittest against them. This is my first project in AS3. In AS2 theres two basic ways of hitTesting: hitTest(Object), or hitTest (Object,x , y). If I understand it right, the first one hitTest against the box the object is contained in defined by its most outlying points. The second hitTest test if any of the pixels that make up the Object actually hit the objet your hitTesting from. A far more precise but also far more heavy method.

In the past I’ve created my own hitTest using basic “range” formulas like srt(dx*dx +dy*dy) but I know of a third method that seems very effective: Drawing small invisible objects on the edges of the object your hitTesting against. So this is what I want to go with.

So far I’ve done everything dynamically (my stage is completely empty until you start the code) and it would be a shame to start manually adding little objects on my Actors (hitTest objects). But since dynamically adding these collisionhelpers would be extremely difficult because I don’t know where the outlying points and curves are on my sprites, I think I will have to add them manually.

So I create several copies of a Movieclip called actorHitTest. And now I’m lost. I want to somehow add these objects to an aray and loop through them. How exactly do I set that up (in an OOP way preferably)?

Help would be greatly appreciated.

Ps. my most succesful but ugly soluttion so far:
Have all the collisionHelpers be governed by the same class CollisionHelper. That class has code like this:

parent.list.push(this);

But that seems like a bad way of doing it. Good thing about it is that it’s not limited to one object, I could create severl different MovieClips for different Actors and have them all be controlled by that same Class as it is a dynamic piece of code.

 
Flag Post

Topic: Game Programming / Explosion generator

Wow its awesome thanks a lot

 
Flag Post

Topic: Game Programming / Explosion generator

Originally posted by phaedy:

Hello,

Here’s a link to a particle explosion generator. There are many options to play with and it can save a transparent png sprite sheet:

http://www.phaedy.com/gamez/archives/229

The same particle engine is used in my latest game:Tank Rush. But since my next game will use only sprite sheets for effects, I created this generator out of the tank rush engine.

In this post there is also a sample (and simple ) class to draw and animate a sprite sheet:

http://www.phaedy.com/gamez/archives/260

The links dont work, but it sounds awesome, send me a PM when its up?

 
Flag Post

Topic: Game Programming / Output: SWF contains multiple copies of a sound item. Is that BAD?

Originally posted by OmegaVitaminC:

every time i test movie, it says SWF contains multiple copies of a sound item.
is that bad?

If thats the literal meaning, than yes. Only keep one copy of a soundfile in your library as they are usually quite large in filesize.