Game Development Community

[Resolved]Making the Player Stationary Object???

by GxG6(Mark-Anthony) · in Torque X 2D · 04/17/2010 (7:21 pm) · 6 replies

I know how to do this in XNA by itself.
but when added it to torque i'm fairly lost on the idea. seeing as components handle movement and the like i tried setting up it up in a component using the code i had used orginally for xna alone. half way through i relized my way was stupid because it would conflict with the movementcomponent there already.
so i decided to edit the movement component itsself. and i look at that gamepad/keyboard states and i'm, at a total loss.
Have patience with me, I'm new to Torque and i really want to get used to coding with it. it doesn't make sense for me to continue to use plain xna coding when i have the engine right infront of me.

so long story short.

any ideas or examples of how you would go and make a player object, that is in a fixed position, that can only rotate 180degrees

sorry if there are and any errors in my typing i'm totally sluggish at the moment.

#1
04/18/2010 (3:25 am)
this should keep the rotation within 180 degrees just put it in the ProcessTick of your MovementComponent

if(move != null)
{
   _sceneObject.Physics.AngularVelocity = move.Sticks[0].X * 50.0f;
   if (_sceneObject.Rotation > 180.0f && _sceneObject.Rotation < 270.0f)
      _sceneObject.Rotation = 180.0f;
   else if (_sceneObject.Rotation > 270.0f && _sceneObject.Rotation < 360.0f)
      _sceneObject.Rotation = 0.0f;
}
#2
04/18/2010 (4:46 am)
omg wow thanks richards. when i compared our codes i realized when i kept getting errors,i kept trying to do "Player.rotation" LOL thanks now i don't feel sooo stupid
its its actually simpler than what i did in xna
#3
04/18/2010 (10:40 am)
Mark did you download my game kit? I have a few examples and a number of components to get you started.

www.torquepowered.com/community/resources/view/19137
#4
04/18/2010 (11:19 am)
that i did it is very helpful resource.

I'm just having problems applying what i saw to my own projects.
I know its a case where i'm either skipping code segments or not paying attention to the placement of code.i'll get the hang of it. hopefully :/
#5
04/19/2010 (9:33 am)
Using an engine is not really particularly easier than not using an engine. I believe that is one of the misconceptions that people come here with. On top of learning some XNA you also need to understand the engine framework.

The result is that the engine will amplify your efforts. The engine has a number of systems in place that you will not have to create, like collision, particles, layering etc. I built my first project in straight XNA. I had to sort all my layers in the spritebatch draw function. I don't even want to talk about my simple particle engine ;)

Hang with it and I am certain you'll have good results.
#6
04/19/2010 (3:52 pm)
i realized that after getting into torque. I'm soo used to using "drag and drop" interfaces since i last used VB C# is kinda wacky to me but i'm drawn to do it. its what i believe i was made to do. even after a nuclear sized headache from programming i still go back for more its in my blood i'll never stop! i'm just happy there are people around here and in the XNA site that give soo much support! its calming in a way