agecaf
10 posts
|
Topic: Game Programming /
Problems with code.
Maybe the problem is
army.push( newEnemy );
addChildAt( newEnemy , 1 );
I think that
army.push( addChildAt( newEnemy , 1 ) );
should work
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
Something related with Error 1061
Thank you very much, I tried doing something likeSenekis told me (using an array of items) and it worked properly. I added a public array and then wrote in the item something like:
antecesor.array.push( antecesor.addChild(this) );
The thing was that I couldn’t use the parent to add the child; the invoker was a turret and the item a bullet. The antecesor was the space in general (With turrets and bullets). So turrets “invoked” bullets and the bullets added themselves to the space. I think controlling all from the antecesor would have been much harder (turrets have different firerate and bullets have different speed), so the update function made it a lot easier. Thank you also DPbrad, now I know how to solve that question… 8)
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
Something related with Error 1061
I actually understand what error 1061 means (That a class doesn’t have that property), but I want to know how can I call a property that is in a subclass of a class which doesn’t have that property. I’ll explain myself.
I have three objects: the antecesor, the invoker and the item. The invoker calls the item (
var anItem = new item(myAntecesor)
)
and the item, using the antecesor, adds itself into the antecesor object
myAntecesor.addChild(this)
the invoker makes many items, and each item has to be updated with the update() function. The only way to call all functions is using a code in the antecesor like this:
for( var i = 0; i < this.numChildren; i++)
{
if( this.getChildAt(i).toString() == “[object item]”)
{
this.getChildAt(i).update();//Here is the error
}
}
The error comes because the Display object class doesn’t have the update function (the item class extends MovieClip and thus DisplayObject), but I check if it is an item object and then call the function.
Is there a way to “tell” the antecesor that this.getChildAt(i) is an item if it has passed the if(…) filter?
|
|
|
agecaf
10 posts
|
Topic: Collaborations /
Need some suggestion for this game demo
Hey! Now this problem remembers me of a mathematical problem: The shortest path problem:
Imagine you live America and you are going to visit 25 friends in Europe, and you want to find the shortest path to visit them all. The exact opposite of your game. This becomes very interesting if the number of points increases, as the number of solutions increase enormously. You could maybe include a “shortest path” mode in addition to the “largest path”… and I suggest placing the points more randomly… or at least less symetrically, to increase the possibilities.
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
What happened?
I don’t know what happened, but after reloading the page several times it finally worked. Thanks.
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
What happened?
I’ve debugged it, and it works fine. It only had some output messages, that I wrote here. (I changed name and Myname)
Attempting to launch and connect to Player using URL /Users/name/Desktop/Myname/flash/PIXOR/Pixor.swf
[SWF] Users:name:Desktop:Myname:flash:PIXOR:Pixor.swf – 2314009 bytes after decompression
[SWF] /flash/API_AS3_Local.swf – 11110 bytes after decompression
Alert: Kongregate API shadow services loaded due to local testing. API will load when the game is uploaded.
Kongregate API: IKongregateServices.connect()
No Errors, and the Alert is easy to understand. But It should work on Kongregate…
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
What happened?
I haven’t send the code because it is too big, and I don’t think the problem is caused by a simple mistake (missing a semicolon, = instead of ==, misspelling variables), because If it was, the game wouldn’t work on my computer too. But If you want to see the code, I’ll sumarize it:
Code on Scene “Game” Layer Two (Layer 1 is for music, and that works)
//Building the Level, All work
addEventListener(Event.ENTER_FRAME,fOEF);
function fOEF(e:Event ):void
{
// What doesn’t happen on the Preview, but works on my computer
}
// KeyCode reading function, which works as you can pause the Game (shows the pause screen)
// Other functions like “Mute”, “EndGame”, etc…
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
What happened?
Well, I have been making this game since long time ago, and It has always worked. But, When I upload it to kongregate, the game doesn’t work.
I’ll explain myself.
The game consists of a preloader, a title screen, a select level screen and the main game. Each level is built during the begining of the main game, and then an “OnEnterFrame” funtion makes it work (The character jumps, walks and gets to the exit). When I uploaded it to kongregate, All except the main “OnEnterFrameFunction” worked, so the Title, the preloader and the level select scene were ok, and even when I selected a level that level was built, but then the character didn’t move.
Does anyone has any idea of what has happened? Any Idea of how to solve it?
|
|
|
agecaf
10 posts
|
Topic: Collaborations /
teacher / partner wanted
Have you tried using online tutorials? There are some very good ones like kirupa.
But if you have a specific question you could ask me, and I would try to answer.
|
|
|
agecaf
10 posts
|
Topic: Game Programming /
how do i create a list
By a list… do you mean a group of ordered numbers, words (Strings), objects, etc? If yes, have you tried ussing Arrays? You can have your Array like this:
var myList = new Array(item1,item2,item3)
Then you can see or change any item of the list by using
anItem = myList[ 0 ] //anItem = item1
myList[ 1 ] = item4 //item2 is changed for item4
And then you can change, swap, cut, etc. your Array by using the functions of an Array.
If you want a text box that is updated and cannot be changed by the player, you have to make a TextBox in the Scene, and If you are in AS3, you have to change it from “TLF Text” to “Classic Text” in theProperties Pannel, then change it to “Dinamic” (It can also be "Static or “Input”) and write something in the Instance Name thing (For example myText). Then, in the Actions Pannel (Of the Frame), you write the function Update()
function Update()
{
myText.text = “Hello” // Or any variable or text you want to have in your TextBox
}
And you call that function any time you want to update the text (Could be each frame, each second, each time you press a button, etc)
|