Recent posts by GhostIV on Kongregate

Subscribe to Recent posts by GhostIV on Kongregate

avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Collaborations / Need an artist

Posting bmp images is bad. Very bad.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Collaborations / The Wall!!

Ok. First of all, you should rework the movement system. Add acceleration-deceleration, inertion, and make it smoother. Like, not so erratic. I also think you should make it angle-based, so your ship could move in a direction of some angle. This will automatically give you some physics and make the game smoother.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / AS editor

Hmmm… i dont know what should i use… Should i use FlashDevelop or FlashDevelop? Or maybe i should go for FlashDevelop instead?
Oh well… i think ill look into FlashDevelop thingie and forget about other options for now.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Object moving to point?

Omg. Google is your friend… friend:)
Also, school is your friend too. As well as Pythagoras.

To get the distance between 2 points you need to get sqrt(xDistance*xDistance + yDistance*yDistance);

If you have an angle the object moves towards than


vX=Math.cos(moveAngle/180 * Math.PI) * speed;
vY=Math.sin(moveAngle/180 * Math.PI) * speed;
this.x+=vX; // for as3;
this.y+=vY; // for as3;

moves that object where his angle is pointing with constant speed.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Theoretical Game Design Challenge

I dont really know if this is it, but…
In Fallout 2 you could get forcibly married to a person of a different sex(if youre male, than you get a wife. And vice-versa).

The thing is, that this “partner” is extremely annoying, useless and takes the space that could be filled by more usefull npc’s. Also, you constantly run in danger of him/her duying because he/she has little amount of hp. And you cant “lose” him/her by telling this spouse to get lost.

So the outcome is pretty simple – once you get this burden, you have to either get him/her killed or make a kill yourself. But this is kind of bad from the roleplaying side of view.
BUT, insted of killing, you could sell him/her to slavers. That is kinda morally objective, but you get some extra cash AND avoid your partner getting killed.
So if the player doesent save/loads, and get married he really has only “bad” choices if he wants to stop worrying for this useless mule for the rest of the game.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Question about saving and achievements AS3

Im not really sure but i think you could make one savefile.data.achievements and make it an array, with each position meaning some kind of an achivement. So savefile.data.achievements[ 0] would be achievement1, savefile.data.achievements[ 1] would be achievement2, and so on.
You could also make items in that array Boolean. So its True if its achieved or False if its not.
Also, you could store a string of 1’s and 0’s, with each character meaning some kind of achievement. But it would be a pain to unpack it, i suppose.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / How to get rid of all the hackers

I think this is a good idea. Mostly it would be usefull for game developers.
So they put a badge for something that seemed impossible, and if someone achieved it, it is possible that there was a bug in the game that let someone do this.

It shouldnt give points for that, so the people wont hack the game for it and the readings would be accurate. A good testing tool, imho.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Collision detection and sliding problem.

Thank you everyone for posting, but none of your advice helped:(
But after some thinking and testing i found out that all i need is to find a way to get the exact angle towards the collision. Or at least in which 90 degree sector it happened. Then i can just block the tanks movement in that direction, while still enabling it to move along the border.
Is there a way to do that in CDK?

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Collision detection and sliding problem.

So ok. Im using CDK for my collision detection. So far, its been really helpfull.
But the function i wrote(with the help of cdk examples) just makes the players object(the tank) stop instead of continuing along the border of the object.

this is the game so far:
http://www.swfcabin.com/open/1257644383

the code:


function checkCollisions(){
colResultArray=colList.checkCollisions();

if(colResultArray.length)
{
var collision:Object = colResultArray0;
var angle:Number = collision.angle;
var overlap:int = collision.overlapping.length;

var sin:Number = Math.sin(angle);
var cos:Number = Math.cos(angle);

var vx0:Number = Chasis.vx * cos + Chasis.vy * sin;
var vy0:Number = Chasis.vy * cos – Chasis.vx * sin;

vx = vx0 * cos – vy0 * sin;
vy = vy0 * cos + vx0 * sin;
}
}

arrow rotates in the direction of vx and vy.

Chasis.vx and Chasis.vy is the current x and y speed of the tank.
after vx and vy are calculated, the same movement algorythm used to mave the object normally is used, but the vx and vy are reversed(-= instead of +=)

How do i make it continue moving along the border? Making it less bumpy would also help.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Could this code work AS3

A === B; //Tests strict equality (class type AND data) between A and B

Wow. Didnt know that. Thank you:)

Originally posted by UnknownGuardian:

In relation to the void questions, can’t you still have the word return in void methods, but just to kill(stop) them. like this:

No idea. Maybe you should chack it out.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / slingshot catapult and canon?

Cannon is easy
You just have to define the initial speed of the bullet and then change it over time with predefined values.

Something like this:


var spdX,spdY,gravityMod;

Define the gravityMod with some value.
Then when the cannonball is shot you define the starting speed. I recomend looking up the move based on rotation method.
Then you just change the coordinates by the speed value and then change speed on predefined values. like this:


this.x+=spdX;
this.y+=spdY;
spdY-=gravityMod;

This way your ball will start falling down over time.
You could also add air friction and wind as an additional parameters and modify speed some more.

CATapult and slingshot are harder, because you have to calculate how the ball moves before it leaves the … ummm… however the thing that holds the ball is called… sling? I cant say anything on this part.
But after that in a free flight its pretty much the same.

I hope i helped at least a little. Godspeed.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Could this code work AS3

Originally posted by zero579911:

Oh so people use void because they don’t know anything else better to use?

So Void is used to check if it doesn’t return anything?

Ummm… no. Void means function doesent have any return value.
Normally, in c++ for example, every function has some return value. So people write their function headers saying what they want to return. For example:

public int myFunction(double param1){
...

In the end of the function body we have to write something like “return n” and it would return the n, which was defined as integer in our function. It means that we return an int value and we may write something like this when we call this function:

i = myFunction(n);

And “i” would have some number.

But we may not want to return anything. The problem is that even if you dont define your return type the compiler thinks you return int by default. And if he doesent see the “return” he throws a compile error. To tell the compiler you dont want to return anything you write “void” instead of the return type, saying that this function doesent have anything to return and thus, has no “return” operator.

Its not necessary in AS3, as its a lot less strict than c++, c# and the like. But its considered a good style to put void in return type still.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Random pages

Carr77
Or you could use more direct approach SuperFalconKick and Wordblind proposed.

In my case, you modify the code so that it suits the purpose of an application.

Pros and cons:

1st way:


var frameRand = Math.random()*n;
if(frameRand>=0 && frameRand<1) gotoAndPlay(3);
else if(frameRand>=1 && frameRand<2) gotoAndPlay(4);

pros:
-You have a large degree of control you have on what frames it goes to. You can change the probability with which each frame changes to and which frames exacly are used. So you can jump, for example, only to frames 3, 6 and 7, ignoring 4th and 5th frame.

cons:
-Lots of text. A fairly straightforward way lacking elegance.

2nd way:

 var frameRand = Math.floor(Math.random()*(b-a+1)+a);
gotoAndPlay(frameRand);

pros:
-An elegant way to solve the problem. Very little text.

cons:
-You can only specify a certain range of frames it jumps to.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Random pages

Forgot to add “etc” at the end of the code. There should be a separate if for each gotoAndPlay();

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Random pages

I think its something like

 
var frameRand = Math.random()*n;
if(frameRand>=0 && frameRand<1) gotoAndPlay(3);
else if(frameRand>=1 && frameRand<2) gotoAndPlay(4);

Where n is how many frames you want it to pick from.

 
avatar for GhostIV GhostIV 16 posts
Flag Post

Topic: Game Programming / Hittest questions.

Hey everyone.

Ive encountered a small problem i cant find an answer to in google or goole-like services.

Im writing a small flash game where a user can ride around in a tank and kill stuff.

Problem 1:
I want to implement uneven objects in the game. Like garages. But i want it to be one symbol instead of a collection of smaller sqare like ones.
Im using a CDK by Corey O’Neil for detecting collisions.
Ive managed to make it work, but i cant figure out how to make my tank stop moving in the direction of the object it bumped into. I still want it to be able to move in other directions, like along the object, but i dont want it to fall through.
Ive figured that i could use the angle CDK returns to prohibit the movement but it seems useless, as it doesent really return any usefull information, just a general direction of the hit.

So how do i do this? How do i limit directions my tank can move to when it bumps into another object?

Problem 2:
CDK problem again. I create the CDK List variable in my tank class. I also want to add the obstacles in the tank constructor function. But when i try to do that, flash cant find the required object on stage.
I figure that the object is just not loaded yet, because when i add it later after in the course of te game it works just fine. How should i fill up my collidable objects list?
Maybe i should create some extrnal object that would track all the collisions?

The unfinished version of my flash is here:
http://www.swfcabin.com/open/1257348723