Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsAre you calling the choosePlayer function at all?
right now I just have the doc class named Game_Manager and it:
public function Game_Manager()
{
init();
}
function init():void
{
}
runs an init() function which contains all the coding for the game.
how could I have the choosePlayer function run at start of game?
This is a sign that you should probably reorganize.
Haha yeah I know... It was the first game I made 6 months ago so it's messy. I've learned to clean up but I wanted to revisit this game and make it playable for two people.
Are you calling the choosePlayer function at all? Are you resetting the values that you just changed? Put traces in each of the functions to see if they're working.
How should I call this function. Cuz I don't really know how to call functions without event listeners. And there is no event listener that I can think of cuz this function is suppose to run at start of game....maybe I should make a play button and then call that function to start game. Right now I just have the game load right away (again I made this back when my coding was very limited and knew nothing about OOP and classes...)
If the actual value of startNumber isn't used except for comparison, then you don't have to multiply by 10 or round the value at all. Just compare Math.random() < .5
Ah yeah I don't know why I do that. Bad habit...
Sam I tried something just like that and it didn't work. I did take your advice though and pull my code out of ENTER_FRAME.
Here I have some coding for the hero and villian (player one and player two) buttons.
heroAttack.enabled = true;
heroAttack.alpha = 1;
heroMagic.enabled = true;
heroMagic.alpha = 1;
heroHeal.enabled = true;
heroHeal.alpha = 1;
villianAttack.enabled = true;
villianAttack.alpha = 1;
villianMagic.enabled = true;
villianMagic.alpha = 1;
villianHeal.enabled = true;
villianHeal.alpha = 1;
then I also have:
var startNumber:Number;
startNumber = Math.ceil(Math.random() * 10);
function choosePlayer():void
{
if (startNumber <= 5)
{
playerOneState();
}
else
{
playerTwoState();
}
}
function playerOneState():void
{
playerOneTurn = true;
playerTwoTurn = false;
heroAttack.enabled = true;
heroAttack.alpha = 1;
heroMagic.enabled = true;
heroMagic.alpha = 1;
heroHeal.enabled = true;
heroHeal.alpha = 1;
villianAttack.enabled = false;
villianAttack.alpha = 0.5;
villianMagic.enabled = false;
villianMagic.alpha = 0.5;
villianHeal.enabled = false;
villianHeal.alpha = 0.5;
heroAttack.addEventListener(MouseEvent.CLICK, onHeroAttackClick);
heroMagic.addEventListener(MouseEvent.CLICK, onHeroMagicClick);
heroHeal.addEventListener(MouseEvent.CLICK, onHeroHealClick);
villianAttack.removeEventListener(MouseEvent.CLICK, onVillianAttackClick);
villianMagic.removeEventListener(MouseEvent.CLICK, onVillianMagicClick);
villianHeal.removeEventListener(MouseEvent.CLICK, onVillianHealClick);
}
function playerTwoState():void
{
playerTwoTurn = true;
playerOneTurn = false;
heroAttack.enabled = false;
heroAttack.alpha = 0.5;
heroMagic.enabled = false;
heroMagic.alpha = 0.5;
heroHeal.enabled = false;
heroHeal.alpha = 0.5;
villianAttack.enabled = true;
villianAttack.alpha = 1;
villianMagic.enabled = true;
villianMagic.alpha = 1;
villianHeal.enabled = true;
villianHeal.alpha = 1;
villianAttack.addEventListener(MouseEvent.CLICK, onVillianAttackClick);
villianMagic.addEventListener(MouseEvent.CLICK, onVillianMagicClick);
villianHeal.addEventListener(MouseEvent.CLICK, onVillianHealClick);
heroAttack.removeEventListener(MouseEvent.CLICK, onHeroAttackClick);
heroMagic.removeEventListener(MouseEvent.CLICK, onHeroMagicClick);
heroHeal.removeEventListener(MouseEvent.CLICK, onHeroHealClick);
}
Essentially playerOneState would remove listeners to other players buttons and visually change it's properties to indicate that they are not usable. playerTwoState does the same too player one's buttons.
Yes I am aware that this may not be the most clean way to do it. Nonetheless, the choosePlayer function isn't working....
When the game starts both players have their buttons active and are both at 100% alpha.
Any idea why. I have everything else working in the game. It's just this last thing. The coding kicks in after one of the players makes a move. I want the game to start with one of the players unable to play until other makes it move.
I could post full code if you want but since it is all in one doc class I must warn you it's kinda long....
so I lied. Decided to not go to bed. I tried my method above and it didn't work at all. I don't know if it is because the above method is in the ENTER_FRAME function and other functions that are trying to change Booleans are in other functions... or could it be that the ENTER_FRAME function is first function stated before other functions (not sure if ENTER_FRAME has to be last function in list - something I've always done out of habit - or maybe it doesn't matter what order functions are listed.
Now I'm just rambling on. Time for bed. Any help would be much appreciated guys.
So I figured out it wasn't working because I needed to put it in a ENTER_FRAME function.
Now I just need to figure out how to make it so that after say playerOne makes his move then it disables his controls and enables playerTwo controls.
I'm thinking using Booleans for this. Like:
playerOneMove:Boolean
playerTwoMove:Boolean
and say if playerOne starts then it's Boolean is set to true and playerTwo is set to false. Then after playerOne makes a move which trips one of the event listeners to set it's Boolean to false and playerTwo set to true.
Not sure if this will work or if it is the most effective way. It's past 3am and I'm crashing so I'll work more on it tomorrow. But if anyone wants to give some input it would be much appreciated.
Correction in case anyone thought I typed code wrong...
if (startNumber <= 5)
{
playerOneStarts();
}
else
{
playerTwoStarts();
}
So I'm creating a little test game (AS3) where players just take turns attacking, casting spells, or healing till they kill the other. It works. The players take turns clicking on buttons (Attack, Magic, Heal) to do the player's actions.
I'm trying to figure out how at the start of the game to have the coding decide which player gets to start first. I am trying to do this with math.ceil(Math.random(). Like for example:
var startNumber:Number;
startNumber = Math.ceil(Math.random() * 10);
where say:
if (startNumber <= 5)
{
playerOneStarts
}
else
{
playerTwoStarts
}
The functions playerOneStarts and playerTwoStarts just disable the buttons of the other player until one is pressed which then disables that current players buttons until following player presses a button.
I'm having trouble getting the math.random working. Should it be placed in say an ENTER_FRAME? Or am I going about this all wrong....
Another way to reuse functions: For my game, you can target an enemy by clicking its sprite or clicking a button with its name written out. Both of them link to the same MouseEvent. I type check e.currentTarget to see if it's a dude or button. If it's a dude, fine; if it's a button, the corresponding dude is in button.data.
Oh that's interesting. Thanks for the input :)
The above idea I suggested works. But if anyone has better suggestions within all the context that I explained above then feel free to tell me.
I came up with a solution after digging around in my head with what code I know so far....
What if I created a function called playerOneAttack. So I could do:
heroAttack.addEventListener(MouseEvent.CLICK, onHeroAttackClick);
function onHeroAttackClick(event:MouseEvent):void
{
playerOneAttack();
}
and have the function playerOneAttack contain all the code that happens when the button is clicked on or keyboard key is pressed for the attack.
Would this be a reasonable way to do what I want?
For the record, this is technically the first game I ever created about 6 months ago. Back then I had not learned about OOP or working with classes so everything is just in the Document class.
So I'm creating a little test game (AS3) where players just take turns attacking, casting spells, or healing till they kill the other. It works. The players take turns clicking on buttons (Attack, Magic, Heal) to do the player's actions.
So for the attack button (instance name: heroAttack) I have your standard mouse listener:
heroAttack.addEventListener(MouseEvent.CLICK, onHeroAttackClick);
and then the function:
function onHeroAttackClick(event:MouseEvent):void
{
does stuff
}
Now this all works. But I want to make it so that besides clicking the attack button the player could also press the A key on the keyboard to make the attack button work. How would I do this??? I know how to map keys for things like, for example, walking in a game. Is there a way that when someone presses the A key it calls the function listed above??? Not sure if that would work though as that function is listening for a mouse click... Or do I have to more or less duplicate the coding for that function but remap it for a key press.... Was hoping there was another way then doing that as that seems rather redundant....
Thanks in advance guys.
Container = something that extends DisplayObjectContainer, usually just a Sprite. level-, game-, main- are just the names we use for that sprite to suggest what its purpose is.
Oh ok gotcha. You know you, MSGhero, and kkots are always helping me out on the forums and the knowledge that you guys possess with AS3, and coding in general, is incredible. I've only been at this on and off for the past year. This next year I plan to work on it consistently. Everything I've learned so far is through a book I bought. It only has 3 more chapters left that have to do with physics, arrays (looking forward to learning about those) and AI.
So I'm really curious where I should look to continue my learning? Where did you guys learn this craft? I don't know if I should find another book or just do endless online tutorials... I don't want to just learn the code but also to fully understand it.
:In your example you add the player to the level and also move the level. The player should move independently of the level. The level assets should then be added to the main container (I usually also have another container to hold all the level assets).
I didn't now that the player moved independently of the level. I thought that parallax scrolling gave the illusion of the player moving but it was actually the level moving (at least with what I'm doing which is that top down view kinda game).
What I'm trying to do is have the player be able to roam freely within the limits of a "boundary box" and once the player hits the edge of this boundary box and keeps walking then the level moves instead of the player. Only once the player reaches the end of the stage can he walk outside his boundary box and touch the edge of the level. Don't know if I explained that well enough...
I really appreciate all of your feedback. It's very comprehensive and I will definitely be referring back to it. I'm still have a long way to understanding code. You see I have yet to learn about Arrays (know what they are and understand why you need them I just haven't learned how to code them) or even physics (i.e. making your character jump).
I do have a amateur question for you... In your examples you mentioned containers. Now I do understand what containers are for and why we need them, yet when ever someone suggests in these forums (to my post or others that I read) I am at a loss.
Is there any way you could explain containers simply to me? I've seen levelContainer, gameContainer, mainContainer and many more. What do they all mean or consist of? How exactly?
Thanks in advance.
I really should just let it rest till someone gives some input but I've been at this for hours and it's driving me mad...
I guess I don't know shit about parallax scrolling.
I just made a different test. Just used to layers on main timeline. One was a background MC and other was Player. Didn't even use addChild I just physically but them there.
No matter how I tried I couldn't position the player anywhere that I wanted....
The stage is 600x500. LevelOne is 1200x1000. No matter what value I try when I position the Player, for example
player.x =800 player.y ==800, the Player just ends up close to the top left of LevelOne.
So I'm doing a little demo game to test some things out (still pretty new at this). For this test I'm not using multiple classes like I've done before - not even a player class. I am just putting everything into the Main class (doc class). I know it's best to not do it this way but for the sake of my test I went with it this time around...
I have one MC (LevelOne) and addChild that to the stage. Inside LevelOne is a background MC which contains all the other elements of the game. Then I addChild the Player to LevelOne.
I was just trying to setup movement with parallax scrolling which I got to work and am learning to understand it. However, the problem is that I can't addChild the Player to a specific location inside the level.
I've tried everything I could think of for the past 3 hours. Player.x = (whatever value) or many other variations of this. I know I don't fully understand parallax scrolling so maybe it is something I am missing in that area of coding. I made the mistake of taking 3 months off of learning coding to focus on filmmaking (it's what I do) and it kinda screwed what progress I was making.
Here's the code:
package
{
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
import flash.events.MouseEvent;
public class Main extends MovieClip
{
//Add var to stage
var levelOne:LevelOne;
var player:Player;
var vx:int;
var vy:int;
var rightInnerBoundary:uint;
var leftInnerBoundary:uint;
var topInnerBoundary:uint;
var bottomInnerBoundary:uint;
public function Main()
{
init();
}
function init():void
{
//Initialize variables
levelOne = new LevelOne();
addChild(levelOne);
player = new Player();
levelOne.addChild(player);
//THIS IS WHERE I TRIED POSITIONING PLAYER BUT NO LUCK WITH WHATEVER I TRIED
rightInnerBoundary = (stage.stageWidth / 2) + (stage.stageWidth / 4);
leftInnerBoundary = (stage.stageWidth / 2) - (stage.stageWidth / 4);
topInnerBoundary = (stage.stageHeight / 2) - (stage.stageHeight / 4);
bottomInnerBoundary = (stage.stageHeight / 2) + (stage.stageHeight / 4);
//Players velocity
vx = 0;
vy = 0;
//Add event Listeners
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
function onKeyDown(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.A)
{
vx = -6;
}
else if (event.keyCode == Keyboard.D)
{
vx = +6;
}
else if (event.keyCode == Keyboard.W)
{
vy = -6;
}
else if (event.keyCode == Keyboard.S)
{
vy = +6;
}
}
function onKeyUp(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.A || event.keyCode == Keyboard.D)
{
vx = 0;
}
else if (event.keyCode == Keyboard.S || event.keyCode == Keyboard.W)
{
vy = 0;
}
}
function onEnterFrame(event:Event):void
{
//Initialize local variables
var playerHalfWidth:uint = player.width / 2;
var playerHalfHeight:uint = player.height / 2;
var backgroundHalfWidth:uint = levelOne.background.width / 2;
var backgroundHalfHeight:uint = levelOne.background.height / 2;
//Move the player
player.x += vx;
player.y += vy;
//Stop player at inner boundary edges
if (player.x - playerHalfWidth < leftInnerBoundary)
{
player.x = leftInnerBoundary + playerHalfWidth;
rightInnerBoundary = (stage.stageWidth / 2) + (stage.stageWidth / 4);
levelOne.background.x -= vx;
}
else if (player.x + playerHalfWidth > rightInnerBoundary)
{
player.x = rightInnerBoundary - playerHalfWidth;
leftInnerBoundary = (stage.stageWidth / 2) - (stage.stageWidth / 4);
levelOne.background.x -= vx;
}
if (player.y - playerHalfHeight < topInnerBoundary)
{
player.y = topInnerBoundary + playerHalfHeight;
bottomInnerBoundary = ( stage.stageHeight / 2) + (stage.stageHeight / 4);
levelOne.background.y -= vy;
}
else if (player.y + playerHalfHeight > bottomInnerBoundary)
{
player.y = bottomInnerBoundary - playerHalfHeight;
topInnerBoundary = (stage.stageHeight / 2) - (stage.stageHeight / 4);
levelOne.background.y -= vy;
}
//Stop background at stage edges
if (levelOne.background.x + backgroundHalfWidth < stage.stageWidth)
{
levelOne.background.x = stage.stageWidth - backgroundHalfWidth;
rightInnerBoundary = stage.stageWidth;
}
else if (levelOne.background.x - backgroundHalfWidth > 0)
{
levelOne.background.x = 0 + backgroundHalfWidth;
leftInnerBoundary = 0;
}
if (levelOne.background.y - backgroundHalfHeight > 0)
{
levelOne.background.y = 0 + backgroundHalfHeight;
topInnerBoundary = 0;
}
else if (levelOne.background.y + backgroundHalfHeight < stage.stageHeight)
{
levelOne.background.y = stage.stageHeight - backgroundHalfHeight;
bottomInnerBoundary = stage.stageHeight;
}
}
}
}
At 12/8/13 05:49 PM, MintPaw wrote: If you're worried about extremely accurate hit detection then you shouldn't be using the Flash IDE, you should be generating your objects in code, or using pngs. Realize that when you're working in the Flash IDE a lot of your values are going to be rounded wishy-washy decimals.
Thanks for the advice. I will eventually get to that point but right now I'm just making a demo game to practice grasping something else coding-wise. I'll definitely look into what you suggested for future work. Thanks again.
Ah ok. Thanks for the reply dude.
Quick question: When I am creating MC to specific dimensions, for example 50x50 pixels, sometimes it will change it to
50.5x50. Even if I try to correct the 50.5 to 50 it will just snap back to 50.5. Why does it do this?
Is there a way to make it snap to the precise pixels I want. I know that with this small amount it isn't noticeable on screen but I'm not sure if it could make hit detection less accurate. Or maybe I'm just OCD about it haha
So I'm working on a new test game (it's what I do to better grasp new code I'm learning) and I'm working with parallax scrolling with that top down view. I get how it works and how I can control the boundary box around my player.
But what if I wanted stationary stats on the screen. Like the score or the number of lives remaining for the player. How would I do that?
Like would I attach them to the boundary box? Is that even possible? The player? It can't be the stage cuz with parallax scrolling it would just move or disappear as the player walks around.
As you can probably tell I still have a lot to learn but I'm working on it and you guys have always been a great help to me so far.
Change the scaleX and scaleY properties of displayobject. If you want to zoom everything in or out, change the properties of the container. You might have to readjust the container depending on where the regis point is.
Don't do vcams in coding, they mess with collisions or something.
Thanks again for your help dude :)
I was wondering in a flash game with parallax scrolling is there a way to choose how zoomed in or zoomed out the player's view is of the character they are playing with. Like is it just a matter of increasing or shrinking the boundary box around the character.
Is there a way to attach a Vcam to the Player?
Obviously I'm still really new at this and need more practice and tests with parallax scrolling. I'm just having a hard time figuring out what exactly decides the locked level of distance of the player's view is on their character.
Hopefully this made sense....
// update method
if player collides with enemy
player.hp -= 10;
player.play(hurtAnimation);
enemy.die();
points -= 5;
Thanks MSGhero. I am going to have to make a little demo game and test this out. Hopefully I can figure it out!
As always I appreciate your help :)
Still trying to grasp OOP and how different classes communicate with each other..... Maybe I'm just thinking too hard about it. Or maybe I'm just overlooking something simple that once I grasp it a light will turn on in my head and I will finally get it...
Say I have a Player class that controls the characters movements and health. Then say I also have an Enemy class that controls the characters movements, or AI, and it's health.
Which class would I run hit detection in??? Like if I do it in the Player class then it doesn't recognize enemy unless I do something like: var enemy:Enemy enemy = new Enemy ....right? But even then how do I get it to reduce the health in the enemy class?
Furthermore, if I have to initialize the enemy in the Player class wouldn't that make the Player class full of variable being initialized for every type of thing that requires hit detection with the Player??? That just doesn't seem like it belongs there.
I could create like a Game Manager class where I could initialize all variables in the game that require hit detection. Is that what I should do? Seems like it would make one really long class.... Plus that still doesn't solve the issue of how to affect the health state in the Player and Enemy class....
As you can tell I'm seriously having trouble understanding getting classes to communicate with each other.....
I know there are some amazing AS3 coders on these forums so please help me out!
Thanks in advance guys.
Wow I've always wondered the same thing as Barzona and man...... my brain is fried too by everything
MSGhero just put up...
No wonder you, MSGhero, can always help me out with my questions....you've been at this for awhile haha
I have so much more to learn.....welp, time to go back at it.
Just wanted to let you know that by sharing knowledge like this helps everyone eager to learn on the forums and not just the individual who is asking the question :)
Thank you MSGHero that really help shed some need light on what I need to do and I feel like some hope has been restored haha
I still have a lot more to learn about, like arrays, but I will keep at it.
As always, thank you for your awesome input guys!
Oh wow such awesome responses! Some that will take me some practice and time to understand.
To add to this though... Do I really have to declare all variables like var player:Player; player = new Player();?
Isn't there another way to control MC in a game without doing this. Or without instance names -like what if you made a platform game where you collected coins and there were 100 coins in the level - that would be a lot of instance names.
And if you have to declare all variables would that all be done in the document class? Because I can't do any hit detection whatsoever unless all variables are declare in the same document that checks for collision and it just seems like the code could go for ages if there were tons of collisions to check for (i.e. player, enemies, items, ground, wall, etc.). Bare in mind I have to comprehend how getters/setters if that has anything to do with any of this...
I guess I'm just having a hard time trying to get different classes to communicate with one another.
I don't know if I have to continue to state that I've been trying to learn coding for the past few months on my own through a book. Feel like I have to say it cuz if I state something I completely don't understand with coding I don't want you guys to think I stole it somewhere cuz I haven't. Anywho....
I've been learning through a book and when it got to a chapter on OOP I got stuck. Badly. I have spent a week worth of work and a week of thinking how to understand it but I just....can't.
Here is the the coding that is in the Document Class:
package
{
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
public class Main extends MovieClip
{
public function Main()
{
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(event:Event):void
{
//Add event listeners
addEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function onRemovedFromStage(event:Event):void
{
//Remove the onEnterFrame event if
//this object is removed from the stage
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function onEnterFrame(event:Event):void
{
/*Insert player code here such as:
if(player.hitTestObject...blah blah blah */
}
}
}
And here is the code for the Player class:
package
{
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
public class Player extends MovieClip
{
private var _vx:int;
private var _vy:int;
private var _playerHalfWidth:uint;
public function Player()
{
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(event:Event):void
{
_vx = 0;
_playerHalfWidth = width / 2;
//Add stage event listeners
stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function onRemovedFromStage(event:Event):void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function onKeyDown(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.LEFT || event.keyCode == Keyboard.A)
{
_vx = -5;
}
else if (event.keyCode == Keyboard.RIGHT || event.keyCode == Keyboard.D)
{
_vx = 5;
}
}
private function onKeyUp(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.LEFT || event.keyCode == Keyboard.RIGHT)
{
_vx = 0;
}
else if (event.keyCode == Keyboard.A || event.keyCode == Keyboard.D)
{
_vx = 0;
}
}
public function onEnterFrame(event:Event):void
{
//Move the player
x += _vx;
//Stop player at the stage edges
if (x + _playerHalfWidth > stage.stageWidth)
{
x = stage.stageWidth - _playerHalfWidth;
}
else if (x - _playerHalfWidth < 0)
{
x = 0 + _playerHalfWidth;
}
}
}
}
Here is it on newgrounds Dumping Grounds: http://www.newgrounds.com/dump/item/a38e303ce563b2fd2f5e3977001f4b5b
As you can see it works. However, if I try to add coding to the Main class to control the player with things like
player.hitTestObject it doesn't recognize player.
Now I know you would normally do something like var player:Player and player = new Player(); BUT in this book I'm learning
through it did not need to do that and the game I made for the book runs fine. Now trying to test it out in my own project for practice it fails.
Guys, I literally have been at this for days. I know there are a lot of kind programmers on here, like MSGHero, who have helped me grow as a programmer and now I really need your help.
Anything you have to offer would be a great relief.
Thank you kindly :)
*Damn....sorry for the long post....*
Thanks for all the advice guys. I will definitely have to take the time to experiment.
Thanks again :)
Also what is the advantage of having Flash Developer compile the game rather than just doing it all in Flash Pro.?
Is it just because it is easier, smoother, and less buggy?
I decided to switch to Flash Developer because everyone just says its the way to do it and that it is better, but no one has told me why that is.