Khronosis
130 posts
|
Topic: Game Programming /
Creating a game with upgrades
Because you’re the original poster in the thread.
|
|
|
Khronosis
130 posts
|
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Object Depth [AS3]
If you break the problem down into pieces, you’ll see it’s not so daunting.
Here’s some pseudo-code on how you may want to start approaching the problem:
for each child of the current object (hint: numChildren)
add the child to an array (hint: getChildAt)
sort the objects in the array based on their "y" property (hint: read up on sorting methods)
(alternate hint: check the manual page NineFiveThree posted and look up Array's built-in sort method)
for each object in the array
set the index of the object to its new array position (hint: setChildIndex)
Those 3 steps should be nothing scary individually, and the overarching problem will just be a simple matter of connecting it all together.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
TCSCCT Versus and Co-op won't let me login.
This is the programming forum. Perhaps General Gaming would be a better place for this topic.
|
|
|
Khronosis
130 posts
|
|
|
|
Khronosis
130 posts
|
Topic: Collaborations /
ideas for games first one to say the want it gets it
You’re better off learning how to program, draw or compose music (in other words: contribute).
Being an Ideas Guy™ won’t get you anywhere.
|
|
|
Khronosis
130 posts
|
|
|
|
Khronosis
130 posts
|
Topic: Kongregate APIs /
Unity Support
From the API Overview page
The API supports ActionScript 2 & ActionScript 3, as well as Javascript. Other web plugins
(Unity, Java, etc) are supported through the use of the Javascript version of the API.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Slowing down the preloader?
He’s referring to when you test the game inside Flash CS. The options won’t show in the actual Flash Player.

|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Free Music
Here’s a couple audio portals full of community-made music:
http://www.kongregate.com/collabs/sounds
http://www.newgrounds.com/audio/
Most of the songs are uploaded under the Creative Commons Licensing Terms, so as long as you give credit to the author and don’t try to sell the songs, you’re good to go.
http://creativecommons.org/licenses/by-nc-nd/3.0/us/
|
|
|
Khronosis
130 posts
|
Topic: Kongregate APIs /
Screen resolution and kickstarter
According to the FAQ
games have […] a maximum width of 800 pixels. There’s not a hard height limit but please keep it reasonable to make sure your game is still playable.
Edit: Too slow, UG :)
|
|
|
Khronosis
130 posts
|
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Error in AS
Originally posted by sr2449:
if(movedirection = 1)
“=” is for assigning values.
“==” is for comparing values.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
rsps test...?
According to Google it’s a RuneScape Private Server.
Perhaps this thread would garner more interest in the General Gaming or Runescape forum…
|
|
|
Khronosis
130 posts
|
Topic: Collaborations /
Anyone need a writer?
It’s highly recommended that you post samples or previous work in the thread.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Noob after some tips
Adobe’s ActionScript 3 Reference is your friend when you want to know all the properties and functions that are available to you.
For example, if you want to know all the functions the Math class offers, you have a nice list here:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Math.html
As for math, you should definitely brush up on high school trigonometry.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
collision
If you’re going to use a radius around the player to determine if the block is close enough, you’ll want to use the Pythagorean theorem (simply, a^2 + b^2 = c^2), and compare “c” with your radius.
First, create a constant variable that will hold the value of the radius (“hitTestRadius”, for example).
Now, you’ll need to set up the Pythagorean theorem in your code. “a” will be the difference in x position between the player and block, and “b” will be the difference in y position. Solving for “c” will give you the length of the hypotenuse of the imaginary triangle created by “a” and “b”.
Setting up the theorem in code will end up looking something like this:
deltaX = blockArray[i].x – character.x;
deltaY = blockArray[i].y – character.y;
blockDistance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
Finally, you simply compare blockDistance with the radius you assigned your player (“hitTestRadius”). If blockDistance is smaller, it has passed your distance test, and you can allow it to perform the hitTestObject.
Fitting everything into your code, it’ll end up looking something like:
for(var i:int = 0; i < blockArray.length; i++)
{
deltaX = blockArray[i].x - character.x;
deltaY = blockArray[i].y - character.y;
blockDistance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
if(blockDistance < hitTestRadius)
{
if (character.hitTestObject(blockArray[i]))
{
trace(“hit”);
}
}
}
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
collision
For starters, you’ll need an array to store all the instances of the violetBlock object.
Right now, you’re doing:
VioletBlock = new violetBlock(); and
if (character.hitTestObject(VioletBlock))
{
trace(“hit”);
}
The problem with this is that VioletBlock represents only the most recently created instance of violetBlock.
As you create each new instance of violetBlock, you’ll need to store the current value of VioletBlock into some array (“blockArray”, for example), then iterate through the array, checking for a collision between the player and each instance of violetBlock.
This will change your code to:
VioletBlock = new violetBlock();
blockArray.push(VioletBlock); and
for(var i:int = 0; i < blockArray.length; i++)
{
if (character.hitTestObject(blockArray[i]))
{
trace(“hit”);
}
}
Of course this will result in a lot of hitTests per frame, so you may want to consider optimizing the collision detection by either:
a) only performing a hitTest if the block is within a short distance from the player.
b) using simple math instead of hitTest by calculating the difference between the player and block’s x and y positions to determine if an overlap is occuring.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
random for as3?(solved)
Please read the manual:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Math.html
‘random()’ generates a number in the range 0 <= n < 1, so if you want a random number between 0 and 10, you would multiply the result by 10, as such:
Math.random() * 10;
|
|
|
Khronosis
130 posts
|
Topic: Kongregate APIs /
what format does my game need to be
Read the FAQ
We support Flash (swf) files, and Unity game files
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Help with variables
You should consider buying a book. They tend to have better detail than online tutorials/videos.
Here’s an example of a good book on AS3:
http://www.amazon.com/Foundation-Game-Design-Flash-Foundations/dp/1430218215
|
|
|
Khronosis
130 posts
|
Topic: Collaborations /
Ultimate Pirates Online (recruitting)
This is going to end up exactly like your SkyCraft thread.
|
|
|
Khronosis
130 posts
|
Topic: Collaborations /
Help in english
Originally posted by SachaL:
Clik to move.
Don’t be touch.
Large targets brings more points.
Click to move.
Don’t get touched (or hit).
Large targets give (or award) more points.
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
[AS3] Game Key Events Not Responding [SOLVED]
Someone else might have more of an explanation, but this basically means the focus is set on something other than the game object.
A quick-fix is using this when you start the game:
stage.focus = this;
|
|
|
Khronosis
130 posts
|
Topic: Game Programming /
Advice just starting
It’s “addEventListener”, not “addeventlistener”.
Also, you can simplify “x = x – 10” into “x -= 10”.
|