Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Minverva

Pages: 1 [2] 3 4 ... 7
help / Re: origin problem
« on: Fri, Mar 13, 2015 »
Well, I wasn't going to respond because I thought someone with more experience here would help.

Does something like this work?

yoursprite.origin.x = 5;

I'm assuming it doesn't, but perhaps you could use getAngle to find the angle between your sprite and the desired point - and then set the sprite's angle equal to that.

help / Re: Collisionissue
« on: Mon, Feb 23, 2015 »
Again thanks for your replay
i have solved the problem by putting my loop in the update function in playstateclass not in the bullets class
and it went smoothly,i dont know why exactly but the important thing that it worked

Probably because it is only being called once in the playstate update area, but when it was in the bullets class it was being called once for every bullet in existence.

help / Re: FlxInputText Updated
« on: Mon, Feb 23, 2015 »
Neat, I'll have a look at it later. I know I've found FlxText to be fairly incomplete and clumsy to implement at times.

help / Re: Collisionissue
« on: Mon, Feb 23, 2015 »
thanks for replay
well iam not gonna use any specific  angle if that what you meant
anyway,i have done some research lately, and i have come to 2 conclusions
 either i need the classic flxg.collide to work with angles
or i need to find a way to make prefectpixelcollision  to work with flxgroup"like flxg.collide "

I don't understand what you mean by "you aren't going to use a specific angle." You can get the angle of the objects by using Contact.angle and then do whatever you want with that information.

I think that's probably the easiest way, but if that doesn't work for you then maybe you can rewrite Flixel's collide functions.

help / Re: Collisionissue
« on: Sun, Feb 22, 2015 »

Perhaps you can override the collision functions of the objects you are using to include something like:

if(Contact is AngleNeededEnemy)
 //Use Contact.angle as needed


help / Re: Jumping Upside Down
« on: Tue, Feb 17, 2015 »
Can you flip the player's sprite by adjusting its angle to fix it? (no clue)

If I were to do it myself, from scratch, I'd probably override the hitBottom and hitTop functions and insert the jump controls there. That might require some fiddling though - perhaps an interaction between those functions and update would be necessary to make it smooth.

The simplest way *might* be to change FlxObject itself. I'm looking at an older version of Flixel, but, for my version anyway, it would be really easy to make an "onCeiling" boolean in FlxObject, exactly like Onfloor, but using the hitTop function instead of hitBottom.

Keep in mind that you'll have to add that to the updatemotion function too.

games / Re: 2D Game Artist & Animator for hire
« on: Tue, Feb 17, 2015 »
Nice art, maybe when I'm not dirt poor I can hire someone like you. :)

If you want a really funny forum verification question then I got this one when I registered at FlashDevelop to get some help on my reinstall:

String("FlashDevelop ") + Math.round(3.99).toString() + String(".5") == ?:

Late reply, but I think this is a good example of how a couple easy improvements could've greatly improved your game.

When I first started playing I was trying use use the arrow keys and spacebar to fire, which basically meant I couldn't move diagonally. Customizable controls, not using the spacebar for firing, autofire or mouse controls would've solved that.

It does look very nice though and seems technically impressive. Perhaps you could make a more interesting upgrade system, add more enemies and level variety, and turn it into something great.

games / Re: Animal Crackers - Gameplay Trailer
« on: Wed, Jan 28, 2015 »
Look cute and the sprites are nice.

Hopefully it does well.

help / Re: Advanced Aiming Algorithm?
« on: Wed, Jan 28, 2015 »
It's using the quadratic formula to get the solution for the angle and speed. That q value that is being calculated is then square rooted. If q is less than 0, you're going to be taking the square root of a negative, which puts you into the realm of complex/imaginary numbers. This is a safety check for that (I would guess since you got rid of it and saw no difference, that normally you won't get into that situation).

Very interesting, I vaguely remember the quadratic formula from school, but I'm sure we were taught to use it in a very specialized application. I didn't realize it could be used for other applications.

Question mark is the "ternary operator".

Your example was very helpful. Hopeful I remember it when I come across a situation for it.

Also, while my computer was out of commission, did you publish any new games?


Since you seem pretty knowledgeable about mathematics. Do you think you could give examples on how to modify this equation in a few ways?

Accelerating bullets seems like it would be a challenge. Mainly because you would have to keep the maxvelocities in mind.

A more practical and interesting example would be with projectiles with gravity like grenades. Again though, because it uses acceleration the maxvelocity would likely screw up a normal equation.

help / Re: Advanced Aiming Algorithm?
« on: Tue, Jan 27, 2015 »
The code here works pretty well:

I'm not sure what this bit of code is for though:

// Check we're not breaking into complex numbers
   var q:Number = b * b - 4 * a * c;
   if (q < 0) return null;

I got rid of it when converting the algorithm for my program and it seems to work fine. Any clues?

Also, what, how and why is the question mark used for in this bit of code:

var t:Number = ((a < 0 ? -1 : 1)*Math.sqrt(q) - b) / (2 * a);

Here is the full code copied over from their website for posterity:

 * Shoot at a target
 * @param   t   The target to be shot
 * @return      The bullet to be fired (or null if cannot hit)
public function shoot(targ:Target, bulletSpeed:Number = BULLET_SPEED):Bullet
   var dx:Number = targ.x - this.x;
   var dy:Number = targ.y - this.y;
   var a:Number = targ.vx * targ.vx + targ.vy * targ.vy - bulletSpeed * bulletSpeed;
   var b:Number = 2 * (targ.vx * dx + targ.vy * dy);
   var c:Number = dx * dx + dy * dy;
   // Check we're not breaking into complex numbers
   var q:Number = b * b - 4 * a * c;
   if (q < 0) return null;
   // The time that we will hit the target
   var t:Number = ((a < 0 ? -1 : 1)*Math.sqrt(q) - b) / (2 * a);
   // Aim for where the target will be after time t
   dx += t * targ.vx;
   dy += t * targ.vy;
   var theta:Number = Math.atan2(dy, dx);
   // Fire the bullet
   var bullet:Bullet = new Bullet(); = targ;
   bullet.hitPoint = new Point(targ.x + targ.vx * t, targ.y + targ.vy * t);
   bullet.x = this.x;
   bullet.y = this.y;
   bullet.vx = bulletSpeed * Math.cos(theta);
   bullet.vy = bulletSpeed * Math.sin(theta);
   return bullet;

help / Re: Overlap being called twice
« on: Tue, Jan 27, 2015 »
I know this is old, but try changing:

FlxG.overlap(_player, _obstacles, playerTouchObstacle);


if (!dead) FlxG.overlap(_player, _obstacles, playerTouchObstacle);

help / Re: Moving on non-flat 2D surfaces
« on: Tue, Jan 27, 2015 »
This is not something I've done. I think going down you could leave it to your gravity (i.e. acceleration.y).

For going up stairs/slopes you could override the left/right collision of the player with something like:

_player.y = Contact.y-_player.height; //Maybe subtract an extra pixel or two for good measure

This wouldn't look super smooth, but it depends on how big the steps are. You could make it a conditional where you test the difference between _player.y and Contact.y before deciding whether or not to step the player up. That way he would only step up when the steps are small.

Again, I haven't done this, I'm sure errors would pop up in the attempt.

help / Advanced Aiming Algorithm?
« on: Tue, Jan 27, 2015 »
It is pretty easy to aim bullets at the player's exact spot, but does anyone have an experience aiming precisely at a moving player?

Clearly distance, the velocity of the player, and the velocity of the bullet have to be taken into account, but the last part of it seems most confusing to me since the velocity of the bullet is mutable based on the other factors. 

Has anyone solved this?

help / Re: Importing from old computer (problems)
« on: Thu, Jan 8, 2015 »
hehe, I didn' t transposed the numbers. I actually meant since v2.43 flixel is not using Flex 3 anymore and there are no (or not much) users that still use older versions.

Ah okay.

I actually use such an old version because I'd previously downloaded Flixel a long time ago. I started using it much later (but didn't update it) and kind of built up my project too much with it. I think the code is too weird to actually update it to a newer version of Flixel since I basically learned with it.

After I'm done I'm absolutely going to the newest version - probably HaxeFlixel.

help / Re: Importing from old computer (problems)
« on: Thu, Jan 8, 2015 »
Have you read the comment above the code:
Code: [Select]
NOTE: Flex 4 introduces DefineFont4, which is used by default and does not work in native text fields.
Use the embedAsCFF="false" param to switch back to DefineFont4. In earlier Flex 4 SDKs this was cff="false".
So if you are using the Flex 3.x SDK compiler, switch the embed statment below to expose the correct version.

In v2.43 flixel already went over to Flex 4.x.

You transposed the numbers. I'm using 2.34.

I don't think I did read the comment. It seemed like an obvious switch when I saw the lines and it worked when I switched them.

help / Re: Importing from old computer (problems)
« on: Wed, Jan 7, 2015 »
Ok, I found what appears to be the main error. Maybe someone can be saved some heartache later. My game was developed using Flex 3, but the newest (and only available version AFAIK) version of Flex is 4. In FlxGame you'll find the following lines:

//Flex v4.x SDK only (see note above):
//[Embed(source="data/nokiafc22.ttf",fontFamily="system",embedAsCFF="false")] protected var junk:String;

//Flex v3.x SDK only (see note above):
[Embed(source="data/nokiafc22.ttf",fontFamily="system")] protected var junk:String;

Comment out the version 3 embed and uncomment out the version 4 and it seems to work fine. Anyone aware of any other transversional issues with Flex?

help / Re: Importing from old computer (problems)
« on: Wed, Jan 7, 2015 »
Ok, I did get it to compile from the program files location, but the problem with FlxText not working remains. Am I supposed to use Flex,Air with Flixel as my SDK? I hope this is an install issue of some sort, because if it is a compatibility issue I don't know if I could even update this program to a new version of Flixel (and if I could it would probably take a few weeks).

Pages: 1 [2] 3 4 ... 7