Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Sep 2011
Offline Last Active Aug 02 2014 08:14 AM

Posts I've Made

In Topic: How much will this cost approx?

06 April 2013 - 08:41 AM

I'm hoping around 300 bucks or so though.
-A character and running animation.


I doubt you can even get the first thing on your list for $300. 

I'm not looking for a professional quality here, I just want some 2D art for a flash game around this quality(http://funny-games.biz/back-to-zombieland.html)


If it's going to cost that much then I can just spend more hours on it myself I guess.

In Topic: AS3 creating new objects.

03 April 2013 - 12:22 PM

I would make an array (or vector) of Bullet objects and have a var index:int that will tell me what the last used bullet in the array was.


So the implementation would go somewhat like this:




function spawnBullet():void
    //Pseudo code
    //Take the Bullet at position index and "activate it"(by activating I mean setting it's position and adding listeners)
    index = (index+1) % MaxNumberOfBullets;

// This next function I would call every few frames (it depends)
function cleanUp():void
    //Again pseudo code
    //Go through the array of bullets and check if they are ready for "deletion" (by deletion I mean removing the listeners and         
    //maybe making them invisible)


Now what this should do is it will allow you to always have a free bullet object that is hopefully destroyed (unless somehow you needed more bullets than the array could hold, in that case you increase the maximum size and add more bullets to the array) and it will make removing them not really taxing on the PC.


Ofcourse, the special case is when a bullet hits an enemy and it disapears but yout can solve that by implementing a function that will deactivate the bullet which you can, again, call in the cleanUp function instead of handling it manually.


Hope it helps you ;)


(Solved my own question by replying to this reply)

Yep, that could work. Create an array with a shit ton of bullets, make the one's that aren't in use null and when we need some new bullets we can just scan the array for the ones that we're not using. That's what I had in mind. My problem was that I didn't know that you didn't need to specify a name for an object when putting it into an array.


//I did this 
var bulletA:bullet = new bullet();

var ary:Array = new Array(9000);
ary[0] = bulletA

//Instead of doing this-
var ary:Array = new Array(9000);
ary[0] = new bullet();

//I thought that you need a name for an object when putting it into an array, my problem was generating names for all the objects. Since you don't need a name for the object, then I can just put this shit in a for-loop and generate 9000 bullets. Thanks for the reply!



I'm still open to more efficient ways of creating bullets though, but for now this will do. Thanks!

In Topic: Extending a normalized vector?(3d)

02 July 2012 - 05:36 AM

Ok, again, where C is the camera position, and N is the unit look-at vector...

It's the same thing in 3D. If you want your vector to be 2 or 3 times longer, then multiply all of the vector's components by 2 or 3.

To draw your unit length red line:
Start at C and end at C + N.

To draw a longer line that includes the blue:
Start at C and end at C + N*3.

As for determining 2 or 3, or whatever the factor is... that's application dependent, and it's really your call. Best of luck.

I notice that the function call drawLine(fromAllCharacters, vector3); basically treats vector3 as a position, when it's a displacement (ie. a direction times a length). Not sure what you're trying to achieve here, since it isn't at all like what I tried to show you in the first two examples. Note how I end the line segment at C + N*d (ie. a position plus a displacement is a position), not at N*d (ie. a displacement plus nothing is a displacement). These line segment drawing functions deal in positions, not displacements.

A vector V = <V.x, V.y, V.z>, or displacement, is essentially a 1D line segment (or arrow, if you prefer) that always starts at the origin's position O = <0, 0, 0> and extends to the position <O.x + V.x, O.y + V.y, O.z + V.z>. The vector is an extended object.

A position P = <P.x, P.y, P.z> is essentially a 0D point that "starts and ends" at <P.x, P.y, P.z>. The position is not an extended object.

Both objects are defined using three components, and you can even make these components equal in value by setting P = V, but in the end they are not the same kind of object. A displacement is an extended object, a position is not. The start and end points of a line segment are not extended objects.

Thanks a lot, it worked. Sorry for not understanding you earlier :/

In Topic: Extending a normalized vector?(3d)

01 July 2012 - 03:00 PM

Um ok. So it sounds like you want the line segment broken up into two segments? If not, go with what I said earlier.

If so...

d = length(C - O)

Line segment 1: C to C + N
Line segment 2: C + N to C + N + N*(d - 1).

But, I don't know the distance. Here's a diagram of what I want to do, it's in 2d though.(Didn't know how to do it in 3d :?) http://i.minus.com/ibkPqtmdtLP4LE.jpg

Lets go over of what I have to work with:
Everything about the camera, it's position in the 3d world, and where it's facing.

I tried multiplying everything by a value, it kind of works, but it goes too far sometime, like this, see the video.

The code I use right now is-
vector3 = x:cameraGetFacingX * (10000 * 0.1), y:cameraGetFacingY * (10000 * 0.1), z:cameraGetFacingZ * (10000 * 0.1);

drawLine(start, end);
drawLine(fromAllCharacters, vector3);

In Topic: Extending a normalized vector?(3d)

01 July 2012 - 02:16 PM

If you are looking at a particular object...

Get the distance (... ie. the length of the vector that stretches... ) from the camera position C to the object position O being looked at: d = length(C - O).
Multiply your normalized vector by d: V = N * d.
Draw a line segment starting at C and ending at C + V.

(or just save yourself the steps and draw a line segment starting at C and ending at O)

Well, I basically know where I'm looking at, I just need to extend that vector and draw a line at the end of the extended version.