157 Forum Posts by "Etherblood"
At 8/24/14 02:05 PM, GrahamNG wrote: I just went through and made it export on every other frame, but it didn't help. It seems it always loads 7kb before showing the preloader.
Does this link help?
http://www.newgrounds.com/bbs/topic/1360598#bbspost24975514_post_text
At 8/21/14 11:30 PM, Matthcw wrote: Any programming/conceptual wizards know ways to get a diagonal hit test working correctly in flash as3, something similar to this game SHADOW TAG but much simpler please.... I have researched for ages with only 5 hopes left.
I assume that diagonal hit test refers to the character-environment intersection.
Your gamelogic should not care if your game is 3d, isometric, top down or whatever.
Like one a chessboard, the fields should always have the same rank and file, no matter where you view them from.
I recommend writing your gamelogic as if your game was top down, you can easily use aabb rectangle-rectangle intersection then, and calculate the sceencoordinates of your display objects seperately.
If you insist on using the screencoordinates as logiccoordinates you'll have to use convex polygon intersection checks with diamond like shaped hitboxes.
At 8/9/14 02:15 PM, GrahamNG wrote: Where am I going wrong?
All answers appreciated.
Does this help you?
http://www.newgrounds.com/bbs/topic/1360598#bbspost24975514_post_text
Just wanted to add a way to do it using the colorMatrixFilter, if you're familiar with TweenLite I recommend using it instead of doing it 'by hand'.
This link might be useful too:
http://www.emanueleferonato.com/2009/04/28/understanding-as3-colormatrixfilter-class/
var desaturate:Number = 0; // value from 0 to 1, 0=unchanged, 1=greyscale
var subColor:Number = desaturate / 3; // value from 0 to 1/3
var mainColor:Number = 1 - 2 * subColor; // value from 1 to 1/3
var matrix:Array = new Array();
matrix=matrix.concat([mainColor, subColor, subColor, 0, 0]); // red
matrix=matrix.concat([subColor, mainColor, subColor, 0, 0]); // green
matrix=matrix.concat([subColor, subColor, mainColor, 0, 0]); // blue
matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha
var desaturateFilter:ColorMatrixFilter=new ColorMatrixFilter(matrix);
objectTodesaturate.filters=[desaturateFilter];
This code interpolates between the identity-matrix (nothing changes)
[1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0
0, 0, 0, 1, 0]
and a greyscale-matrix
[1/3, 1/3, 1/3, 0, 0,
1/3, 1/3, 1/3, 0, 0,
1/3, 1/3, 1/3, 0, 0,
0, 0, 0, 1, 0]
At 8/2/14 01:10 PM, bkbatman wrote: & what would be a best method of doing this?
Please enlighten me.
I never made a fighter game so i'm not a good source, but a good way to start would be to plan how to organize your code.
Make different classes for characters, characterstates, inputhandling, make a core updateloop etc.
Dont use keycodes in classes which are not part of inputhandling if you want to be able to use custom keybinds.
Think about how to handle transitions from one state to another, how are they triggered, what are the conditions and effects?
There's a lot more and it can be very complex.
Just ran out of time, ill post again later.
At 8/2/14 09:14 AM, bkbatman wrote:public var oneKey:Boolean = false;I have made some typo in code. Since newground don't allow me to some how edit my post. I'll
public function keyPressed(e:KeyboardEvent):void
{
if (e.keyCode == 49)
{
oneKey = true;
}
}
public function keyReleased(e:KeyboardEvent):void
{
if (e.keyCode == 49)
{
oneKey = false;
}
}
public function GameEngineLogic():void
{
if (oneKey == true)
{
Player.gotoAndStop("Taunt");
addChild(SuperArt);
}
else if (oneKey == false)
{
Player.gotoAndStop("Stance");
removeChild(SuperArt);
}
http://www.newgrounds.com/projects/view/786440
fix my typo in here.
You want to execute the gotoAndPlay code etc only once when you transition from one state to another.
Your states in this case are oneKey and !oneKey.
Only execute
Player.gotoAndStop("Taunt");
addChild(SuperArt);
when oneKey in the current frame and !oneKey in the previous frame and vice versa.
(note: 'oneKey == true' is equivalent to 'oneKey' and 'oneKey == false' to '!oneKey')
Also, code like this won't get you far, it's fine for fast 'test-hacks' but it is not scalable.
If you plan to do a larger project like this you should probably check for better ways to do it.
At 8/2/14 11:21 AM, MSGhero wrote: There's a frame label event for when the frame label changes, I think in 11+. Mess around with it and see what info it gives you or google it bc I remember it was weird.
Hmm, sorry for the wrong info then, didn't know there was an event like that.
At 8/2/14 08:49 AM, Hero101 wrote: How do you create an event listener for frame labels. I'm having a hard time searching the net for ways to use frame labels.
I think you'll have to check the label each frame, there is no native label-listener.
.currentLabel == "frameName"
instead of
.currentFrame == frameNumber
should work though.
http://qczma.com/blog/frame-labels-in-timeline-animation-using-as3
At 7/31/14 06:23 AM, Glboom wrote:
Hey, thanks for sharing theese links, interesting read.
At 7/28/14 06:58 AM, Hero101 wrote: As the saying goes...if you find yourself repeating code there must be a better way to go about it....
I didn't really go through all your code so maybe I missed something.
If the order of your levels isn't changeable (the player can't play lv3 before 2 etc) you should just keep an counter for the number of completed levels.
The next step would be to put your levels into an array and using the level counter as index to get the current level, it would look something like this:
private var _levels:Array = new Array(_lv1, _lv2, ... );
private var _activeLevel:int = 1;
public function lvlUpdate(_player, dC):void
{
for (var i:Number = 0; i < _boneArray.length; i++)
{
if (_player.hitTestObject(_boneArray[i]))
{
_levels[activeLevel].removeChild(_boneArray[i]);
_boneArray.splice(i, 1);
}
if (_boneArray.length == 0)
{
_activeLevel++M;
resetLevel(_player, dC);
break;
}
}
}
At 7/26/14 05:00 PM, Barzona wrote: Sounds like Shared Objects might be the best way. I'll Google and check out that link later and try to understand them.
If you decide to use the Api and have problems, just ask.
I had problems using it at first but got it sorted out, this thread might be useful:
http://www.newgrounds.com/bbs/topic/1358516/2#bbspost24944731_post_text
At 7/22/14 07:57 PM, Tacoproductions wrote: myEnemy.x = myCharacter.x - offsetX;
This line of code just sets the x of myEnemy to the x of myCharacter - offsetX, which is 50 in this case.
So myEnemy will always be 50 pixels to the left of myCharacter, which obviously isn't the behaviour you want.
What you want to do is move myEnemy by a given speed towards myCharacter.
This is normally done by:
-determine the direction in which myCharacter is relative to myEnemy
-calculate the distance myEnemy will move (distance = speed * time)
(if you are updating once each frame and you measure your time in frames, time will always be 1)
-move myEnemy in the calculated direction by the calculated distance
At 7/13/14 12:28 PM, Requiemsvoid wrote: Teaching someone to fish by saying they don't know what they're doing or talking about.. doesn't make any sense at all. (that's not how you TEACH anything).
You asked how to fish, we told you to take a fishing rod with a bait, go to a lake, put the hook into the water, wait until you got a fish and pull it out.
The next step would be for you to refine your question.
What is a bait?
How do I know there's a fish on my rod?
You just told us our answers were useless and asked your question again.
Furthermore, how do you expect someone to learn without an example (code to look at)?
We are expecting you to know the basics if you don't tell us that you don't.
So there is no need to tell you how to move an object per code, because we think you know.
I personally still don't understand what your problem was.
So YES, people whom are more fixated on wording and refuse to share information are indeed being elitist. (whether you want to admit it or not) :P
Nobody was refusing to share information, and if you insist that wrong wording is correct, of course someone is going to disagree.
At 7/13/14 12:01 PM, Barzona wrote: Because many developers don't want to give you a fish, they want to teach you HOW to fish, but you weren't even trying. You had written them all off right from the beginning as "elitists", despite the fact that they were trying to help you. They actually were trying to help you, even if you don't want to believe it.
You wanted the code written for you and it made you insecure when they wanted you to actually put forth the effort and do a little searching. Yeah, the code WAS simple. By knowing that, it should tell you that they weren't jerking you around and if you had put forth the effort, you'd have eventually found it and you'd be a better man for it.
Study the code 4 gave you and try to understand why it does what it does so you can apply it to your future queries.
xD
I just wrote pretty much the same (even with the fish), so I'll just quote your answer insted of posting mine.
Also if an "elitist" tells you that you are wrong it is generally a good idea to ask why he thinks you're wrong or explain why you think that he is, instead of just telling him "nope".
The reason why you got no answer in your other post is (in my opinion) most likely due to the fact that you asked a question that has been asked thousands of times and there are thousands of tutorials out in the net.
If you provide no specific information to your case, you are pretty much asking us to write another tutorial just for you...
Try telling us what you have, what you want, what doesn't work and stuff you tried to solve your problem, etc.
(Post as little code as possible, explain the thoughts behind your code instead.)
At 5/25/14 01:27 PM, Vitraxity wrote:Just sort the targets in z-order, and when iterating through them break out of the loop after finding the first one hitting the crosshair.Sorry sir,I didn't get you
What didn't you understand?
Sorting in z-order in this case means, that the frontmost element will be the first element in your array and the last arrayelement will be at the back.
Now you iterate/loop from front to back through your array and memorize which element was first or just break/interrupt the loop after finding your first element.
At 5/25/14 10:45 AM, MetalBooster wrote: I am using hitTest code for automatic weapons in a fps game.
When the mouse button is down,a small invisble box is placed on the crosshair and any target touching it gets destroyed.
I am applying hitTest code on the target in reference to the the small invisble box.
The problem is that what if 3 targets are placed one behind the other with each of them getting shifted by 5.0 on the _x axis(see IMage).
Now,if target 2 is fired,target 1 and 3 also get hit although ONLY target 3 should get hit because it's in the front.
What should I do so that only the target in the front gets hit and then when its destroyed,the target below it and so on....
Just sort the targets in z-order, and when iterating through them break out of the loop after finding the first one hitting the crosshair.
At 5/10/14 12:02 PM, NecroBlight wrote: Here's my cllision mechanics is there something I should change about in particular or is it no good and I should completely ovehaul it?
You're using hitTestObject to detect collisions. If there is a collision you apply rectangular collision solving which I think only works in the first frame after the 2 rectangles start intersecting.
You should replace hitTestObject with a rectangular intersection check.
(Or remake the collision response if you don't want rectangular hitboxes.)
At 4/23/14 06:55 PM, moynzy wrote: Question is, that I can't turn back gravity on or am I doing it wrong.
//hehe
if the player hits the platform
{
//turn grav to 0?
//or yV to 0?
touchingGround
and do I increment players.y position -- so it looks like it's standing accuratelty
}
Another question about jumping.
If I want to jump, how do i jump
//heehe
if(player is touching ground)
if the upKey is pressed
grav - = jumpHeight (lets say jump height is -5)
this means grav will be -18 and there fore vY will be adding - 18 on to its self which means
the players y pos will be shooting up wards.
How to make the player come back?
Cheers guys :D
Much love !
I would use gravity as a constant (unless the surrounding changes, like underwater etc...).
The way I did jumping in my platformer was using to states. (player touches ground => ground, otherwise => midair)
Then each time the player was updated I checked if he was ground or midair and executed different 'physics' code depending on the state, pseudoish it'd look like this:
switch(playerState)
case midair:
vY += gravity;
Y += vY;
case ground:
if(jump)
{
vY = jumpV;//gravity will take the player back down
//change state to midair
}
When switching from midair to ground, make sure to position the players y correctly and set vY to 0.
This is a pretty crude explanation and there are other ways to do it, tell me if you want more details or have problems.
At 4/19/14 08:29 PM, wolftriplex wrote: Alright, so the error I get is that the line is "null or contains no properties" and it is on the first line of code! Now, the code for the game is not linked to any frame at all, like an action, it is in an actionscript file. Now, what I mean by "The class on the flash file" is when in the properties menu on the Flash file, there is a "Class" spot where you link an actionscript file to it!
I am using Adobe Flash Creative Cloud.
Hmm...
Below the textfield where you type in your document class should be another textfield "export in frame", did you try setting it to 2? (not sure if this even changes something)
If not I'm out of ideas.
At 4/19/14 05:23 PM, wolftriplex wrote: But how do I do this? All the Actionscript code, including the main Engine, are all in separate Actionscript files and the Class on the Flash file is linked to the "Engine" actionscript file! I even set the code to start on Frame 2, but it still wants to run the actionscript engine, even though it's not on frame 2 :(
I'm not sure what your problem is, what isn't working, what errors do you get (if you get any), what does the corresponding code look like? What do you mean with "the Class on the Flash file"?
If you're using Adobe Flash CS x you just need to make 2 frames on the timeline, 1st frame for the preloader (nothing else), and the 2nd frame contains the ActionScript to start your game/engine.
At 4/17/14 06:38 PM, wolftriplex wrote: I have changed the properties, but now, it brings up the preloader and loads, but the code still attempts to start and comes up with an error saying that my variables are Null or no properties. It's as if the preloader isn't stopping the code and the preloader just does it's thing.
The preloader doesn't 'stop' code, it just delays the 2nd frame until the loading finished. Put your code on the 2nd frame and it should work fine.
http://www.newgrounds.com/bbs/topic/1360598#bbspost24975514_post_text
Does this solve your problem?
At 4/4/14 02:40 AM, PsychoZombii wrote: what in the name of flashdevelop is going on??
I assume that your onGround() function always returns true after entering the loop, causing the loop to run infinitely and freeze the program.
You might want to check your onGround() function again to make sure it becomes false if "_player.y--;" is executed often enough.
At 3/28/14 03:59 PM, Dupre wrote: What I want it to do is shoot a projectile based on it's X movement, but I'm honestly drawing a blank.
Im not exactly sure I understand your problem. You want to use the bosses speed in x direction to adjust your projectiles?
Like setting the projectile speedX to the bosses speedX?
You can change the audio compression in publish settings.
At 3/21/14 01:39 AM, pybrah wrote: Hey guys, I'm having a problem with Tkinter. My program creates a box and moves where ever you click. But on the clicked location it jutters.
If the distance between your target and the box is smaller than x, your box will overshoot the target.
The velocity will be inverted in the next frame (because the target now 'behind' the box) and it will overshoot again.
The easiest way to solve this would be to just set the box position to the target position if velocity >= distance.
At 3/14/14 03:51 AM, gameObject wrote: enemyArray contains all enemies in the game while characterArray contains all enemies and player, i figured basing updateDepth() on the characterArray will make for a simpler approach, do you think this was a bad idea?
The idea isn't really bad, but your implementation is wrong.
An alternate way to do this would be to have just 1 array with all characters.
You can then loop through it and skip each item that isn't an enemy when updating enemies or use the array filter function to get a filtered version of your array.
At 3/13/14 09:05 AM, gameObject wrote: thanks man. maybe i can call it after the wave is spawned and if the enemy array is empty i remove it? does that sound like a bad idea?
I would call updateEnemy once a frame even if there are no enemies, removing&readding it just makes thinks unnecessarily complicated.
At 3/13/14 07:09 AM, gameObject wrote: public function spawnWave(enemyAmount:int):void
{
for(var i:int = 0; i < enemyAmount*1; i++)
{
addEventListener(Event.ENTER_FRAME, updateEnemy);
}
}
You should also check your usages of eventListeners, i think you intend to calle updateEnemy once per frame,
but you end up calling it once for every enemy ever created per frame.
Make something like an update-function, register it once in your class-constructor and call stuff like updateEnemy from there.
code that removes enemies
enemyArray.splice(i,1);
characterArray.splice(i,1);
Are you sure you can use the same index to remove from 2 different arrays?

