Mouse to control player including direction to trigger movement image in TGB
by Path · in Torque Game Builder · 01/26/2009 (7:54 pm) · 38 replies
I'm looking for the code which is a hybrid between the tutorial mini platformer ninja game and the mole tutorial game.
Fixing an image to replace the cursor like in the mole game with the hammer is easy:
function SceneWindow2D::onMouseMove(%this, %mod, %worldPosition)
{
CURSOR.setPosition(%worldPosition);
}
What I'd like to know is the code just like the ninja moves in the miniPlatformer Tutorial for when the mouse moves Left, it calls either a single image or animation of the player moving left, right to right animation, up to up animation, & down to down animation, possibly also Up&Left, Right&Down, etc....
Is this doable for TGB? Or am I better off sticking to the typical bind keys method?
I found a script that sets an object to follow the x & y of the mouse.
Does anyone know if the x & y will be fully transferred to the object so that a script saying "if object x > 0 then play animation ...." Can work in this situation?
Anyone know of any limitations with this?
Fixing an image to replace the cursor like in the mole game with the hammer is easy:
function SceneWindow2D::onMouseMove(%this, %mod, %worldPosition)
{
CURSOR.setPosition(%worldPosition);
}
What I'd like to know is the code just like the ninja moves in the miniPlatformer Tutorial for when the mouse moves Left, it calls either a single image or animation of the player moving left, right to right animation, up to up animation, & down to down animation, possibly also Up&Left, Right&Down, etc....
Is this doable for TGB? Or am I better off sticking to the typical bind keys method?
I found a script that sets an object to follow the x & y of the mouse.
Does anyone know if the x & y will be fully transferred to the object so that a script saying "if object x > 0 then play animation ...." Can work in this situation?
Anyone know of any limitations with this?
About the author
Recent Threads
#2
Your description sounds like what I'm looking to do plus figure out the variation to the function for 45 degree angles which I'm guessing would be something like "if x && y > than previous x && y position..."
I've got experience with actionscript 3 and no that the longer the code, the more taxing it is on your gameplay, especially if it's calling back on something as frequently updated as mouse movement.
1) Which of the two options you described above will be the leanest when it comes to code?
2) Is there a recommended file size on the image(s) used for each callback direction?
3) I've got TGB Pro, where in the provided source code or elsewhere do you recommend I look for this code, or at least the code to base this function on?
01/27/2009 (5:01 pm)
I basically want to hide the mouse and make the character equal the mouse [see image below].Your description sounds like what I'm looking to do plus figure out the variation to the function for 45 degree angles which I'm guessing would be something like "if x && y > than previous x && y position..."
I've got experience with actionscript 3 and no that the longer the code, the more taxing it is on your gameplay, especially if it's calling back on something as frequently updated as mouse movement.
1) Which of the two options you described above will be the leanest when it comes to code?
2) Is there a recommended file size on the image(s) used for each callback direction?
3) I've got TGB Pro, where in the provided source code or elsewhere do you recommend I look for this code, or at least the code to base this function on?
#3
OK so yeah it should be simple. Start with your really basic mouse capturing.. so use the "onMouseMove" command like in my example. You sound new so I'll take some time to help you out a bit. Also, this is not complete.. it doesn't save states for up/right down/right etc.. but it's easy to do. using getWord, negative y values,, and using callbacks can be tricky if your new. This should give you a start on it though.
Ps, expect typos and junk.
for more info on these functions, look in the TGB level editor and choose help->documentation:
01/27/2009 (5:31 pm)
Ok, nice pic :D. So your basically hiding the mouse and dragging it like a ragdoll. Could be cool. You could even throw him around if you wanted with the build in physics pretty easily.OK so yeah it should be simple. Start with your really basic mouse capturing.. so use the "onMouseMove" command like in my example. You sound new so I'll take some time to help you out a bit. Also, this is not complete.. it doesn't save states for up/right down/right etc.. but it's easy to do. using getWord, negative y values,, and using callbacks can be tricky if your new. This should give you a start on it though.
Ps, expect typos and junk.
$lastMousePosition=0;
function sceneWindow2D::onMouseMove(%this, %modifier, %worldPosition, %clicks){
//did mouse move? Don't waste cycles if not
if($lastMousePosition!=%worldPosition)
{
//get last mouse position
%lastMouseX=getWord($lastMousePosition, 0);
%lastMouseY=getWord($lastMousePosition, 1);
//get current mouse position
%currentMouseX=getWord(%worldPosition, 0);
%currentMouseY=getWord(%worldPosition, 1);
//did mouse move left or right?
if(%currentMouseX<%lastMouseX)
{
//put your animation change or whatever here for moving left
}
else if(%currentMouseX>%lastMouseX)
{
//put your animation change or whatever here for moving right
}
//move up or down?
if(%currentMouseY<%lastMouseY)
{
//put your animation change or whatever here for moving up.. I think Y values, negative numbers go up
}
if(%currentMouseY>%lastMouseY)
{
//put your animation change or whatever here for moving down
}
}
$lastMousePosition=%worldPosition;
}for more info on these functions, look in the TGB level editor and choose help->documentation:
t2dSceneWindow::onMouseMove(%this, %modifier, %worldPosition, %clicks)(%this, %modifier, %worldPosition, %clicks) Brief Description: A mouse event occurred over the object. Description: The object must have mouse events enabled as set by setUseMouseEvents(). Also, for an object to get mouse events, you must call setUseObjectMouseEvents(true) on the sceneWindow Params: this: The object the event was triggered by. modifier: The modifier keys that are pressed. Possible Values -Bit 0: Left Shift -Bit 1: Right Shift -Bit 2: Left Control -Bit 3: Right Control -Bit 4: Left Alt (Windows) or Command (Mac) -Bit 5: Right Alt (Windows) or Command (Mac) -Bit 6: Left Option (Mac) -Bit 7: Right Option (Mac) worldPosition: The current mouse position.clicks: The number of times the mouse button has been pressed.
#4
I'm basically piecing bits of tutorials here and there to try and put some things together to see what I can do, and you've provided the overall code for the only thing I couldn't find.
I found the follow code and is there any difference between it and the hide cursor & replace with image code other than one is about 20 lines and the other is just 4 lines?
You mentioned physics, do you know where to go for some good resources/tutorials on that?
The latest thing for flash is the "FISIX" engine that's pretty impressive for something vector based with primitive rigging capabilities compared to 3D. Is there anything similar to this in TGB or is it strictly TGE and above for the impressive action/reaction stuff?
01/27/2009 (6:54 pm)
Obviously, THANKS!I'm basically piecing bits of tutorials here and there to try and put some things together to see what I can do, and you've provided the overall code for the only thing I couldn't find.
I found the follow code and is there any difference between it and the hide cursor & replace with image code other than one is about 20 lines and the other is just 4 lines?
You mentioned physics, do you know where to go for some good resources/tutorials on that?
The latest thing for flash is the "FISIX" engine that's pretty impressive for something vector based with primitive rigging capabilities compared to 3D. Is there anything similar to this in TGB or is it strictly TGE and above for the impressive action/reaction stuff?
#5
b. Physics in TGB is pretty handy, but it's also quite buggy and primitive. if you just need things to bounce around and don't have to do any joints then TGB could work great for you. You can integrate box2d if you need to do anything crazy, but I wouldn't use box2d for your first project in TGB.
c. look at TDN for tutorials. The basics of it is just create an image in the editor and turn on "rigid" body and send/recieve physics.. then add some gravity and a positive y foce.. and your good to go. There is a bowling ball and pin tutorial on TDN that will get you started.
Finally, I would suggest you look for the simplest idea that you think would be fun.. For instance dragging a guy around with the mouse, and tryig not to hit the walls or something.. like a crazy version of operation. Something simple.. then complete that small project and move to something else more complicated. I only say to start small because I have a problem not finishing projects.
01/28/2009 (1:05 pm)
a) To answer your fist question, you have to tell which animation to play based on your mouse movement.. and I think my general method is the most straightforward way to do that. The answer to your question though is a gameplay decision. If you can tell me what the player does and how it works I would have a MUCH better idea of how to help you.b. Physics in TGB is pretty handy, but it's also quite buggy and primitive. if you just need things to bounce around and don't have to do any joints then TGB could work great for you. You can integrate box2d if you need to do anything crazy, but I wouldn't use box2d for your first project in TGB.
c. look at TDN for tutorials. The basics of it is just create an image in the editor and turn on "rigid" body and send/recieve physics.. then add some gravity and a positive y foce.. and your good to go. There is a bowling ball and pin tutorial on TDN that will get you started.
Finally, I would suggest you look for the simplest idea that you think would be fun.. For instance dragging a guy around with the mouse, and tryig not to hit the walls or something.. like a crazy version of operation. Something simple.. then complete that small project and move to something else more complicated. I only say to start small because I have a problem not finishing projects.
#6
b)&c) I'll be sure to lookup BOX2D
I actually have my first project pretty well mapped out from a conception point of view, and I've got most of the overview scripting figured out through piecing together the tutorials. I'm kind of the opposite, I have problems with small projects, I always have to "go big" on projects or I never seem to get them done.
I just got all the pics done for the character, and I'll post when I've had a chance to integrate the code you've provided.
01/28/2009 (10:05 pm)
a) The player is probably going to be OSAKit. It's buggy, but igLoader isn't offered anymore & Instant Actions' plugin has gotta be way too buggy.b)&c) I'll be sure to lookup BOX2D
I actually have my first project pretty well mapped out from a conception point of view, and I've got most of the overview scripting figured out through piecing together the tutorials. I'm kind of the opposite, I have problems with small projects, I always have to "go big" on projects or I never seem to get them done.
I just got all the pics done for the character, and I'll post when I've had a chance to integrate the code you've provided.
#7
-nic
01/29/2009 (11:11 am)
I'm not familiar with OSAKit or igLoader. Instant action might be a little spendy.. but I haven't looked into it. I'm eager to see what you come up with though. Keep on keeping on kinky turtle!-nic
#8
Ok, using a followMouse behavior, an onMouseDown code to get the character grab animation to play once(but not able to yet get back to the original standing still position afterwards)along with the code you've provided, I've been able to accomplish the first step.
The problem is, everything is in a permanent state of up or down, etc.
1) I'd like to put in additional code to say that:
"if "%currentMouseX" hasn't been less than "%lastMouseX" in the last 2 seconds, then playAnimation(STANDINGSTILL);"
This way I can default the character to a relaxed state until moved again.
I actually added UP-RIGHT, DOWN-LEFT, etc. angle images and movements, but then everything got bizarre, flipping instantly from one pick to the next on the slightest mouse movement. This happens to a lesser degree with the standard four directions like if your scrolling left, you'll nudge it just slighty up and then the UP IMAGE will flicker.
2) How do I add parameters that say:
if(%currentMouseX<%lastMouseX) && (%currentMouseY<%lastMouseY) by less than .2 || (%currentMouseY>%lastMouseY) by less than .2
{
%this.playAnimation(MOVELEFT)
}
else if(%currentMouseX>%lastMouseX) && (%currentMouseY<%lastMouseY) by less than .2 || (%currentMouseY>%lastMouseY) by less than .2
{
%this.playAnimation(MOVERIGHT)
}
Any code suggestions?
01/29/2009 (9:04 pm)
If you don't use OSAKit, igLoader, or Instant Action, what do you use to port your games to the web for others to play off your site? Or do you not do that at all?Ok, using a followMouse behavior, an onMouseDown code to get the character grab animation to play once(but not able to yet get back to the original standing still position afterwards)along with the code you've provided, I've been able to accomplish the first step.
The problem is, everything is in a permanent state of up or down, etc.
1) I'd like to put in additional code to say that:
"if "%currentMouseX" hasn't been less than "%lastMouseX" in the last 2 seconds, then playAnimation(STANDINGSTILL);"
This way I can default the character to a relaxed state until moved again.
I actually added UP-RIGHT, DOWN-LEFT, etc. angle images and movements, but then everything got bizarre, flipping instantly from one pick to the next on the slightest mouse movement. This happens to a lesser degree with the standard four directions like if your scrolling left, you'll nudge it just slighty up and then the UP IMAGE will flicker.
2) How do I add parameters that say:
if(%currentMouseX<%lastMouseX) && (%currentMouseY<%lastMouseY) by less than .2 || (%currentMouseY>%lastMouseY) by less than .2
{
%this.playAnimation(MOVELEFT)
}
else if(%currentMouseX>%lastMouseX) && (%currentMouseY<%lastMouseY) by less than .2 || (%currentMouseY>%lastMouseY) by less than .2
{
%this.playAnimation(MOVERIGHT)
}
Any code suggestions?
#9
01/30/2009 (5:46 am)
For #1, would a simple onMouseSTOP...%this.playAnimation(STANDINGSTILL) work?
#10
01/30/2009 (6:38 am)
[bump]
#11
Then have the onMove mouse callback call your new function. OK, at this point you haven't changed the logic any.
Now inside your onMove function you will need to create a scheduler to call your new "didMouseChange" function. I added room for this case inside it.. notice how it sees if it chaanged? Normally you wouldn't have to look for this since the onMouseMove callback only happens.. if ti moves anyhow.. looks something like this:
01/30/2009 (8:06 am)
1A) yeah you can certainly do that. What you do is make a function called animate player and put the code you have in the onMove method of your mouse in it.Then have the onMove mouse callback call your new function. OK, at this point you haven't changed the logic any.
Now inside your onMove function you will need to create a scheduler to call your new "didMouseChange" function. I added room for this case inside it.. notice how it sees if it chaanged? Normally you wouldn't have to look for this since the onMouseMove callback only happens.. if ti moves anyhow.. looks something like this:
$lastMousePosition=0;
$playerMovementSchedule
function sceneWindow2D::onMouseMove(%this, %modifier, %worldPosition, %clicks){
updatePlayerMovement();
//check to see if it's scheduled.. then cancel the schedule since you just refreshed your stand still timer. PS this is psudo code.. lookup how to check if it's scheduled, and such to get it to work.. but this creates your delayed timer to stop moving after 2 secs.
if(!$playerMovementSchedule.isScheduled)
{
cancel($playerMovementSchedule);
}
$playerMovementSchedule= schedule(2000,0,updatePlayerMovement);
}
updatePlayerMovement()
{
//did mouse move? Don't waste cycles if not
if($lastMousePosition!=%worldPosition)
{
//get last mouse position
%lastMouseX=getWord($lastMousePosition, 0);
%lastMouseY=getWord($lastMousePosition, 1);
//get current mouse position
%currentMouseX=getWord(%worldPosition, 0);
%currentMouseY=getWord(%worldPosition, 1);
//did mouse move left or right?
if(%currentMouseX<%lastMouseX)
{
//put your animation change or whatever here for moving left
}
else if(%currentMouseX>%lastMouseX)
{
//put your animation change or whatever here for moving right
}
//move up or down?
if(%currentMouseY<%lastMouseY)
{
//put your animation change or whatever here for moving up.. I think Y values, negative numbers go up
}
if(%currentMouseY>%lastMouseY)
{
//put your animation change or whatever here for moving down
}
}
else //handle no movement here
{
//put your no movement state here!
}
$lastMousePosition=%worldPosition;
}
#12
Where you've got:
}
else //handle no movement here
{
//put your no movement state here!
}
I put in for the handle:
A) if(%currentMouseX=%lastMouseX) && if(%currentMouseY=%lastMouseY)
%this.playAnimation(STANDINGSTILL);
B) if(%currentMouseX=%lastMouseX && %currentMouseY=%lastMouseY)
%this.playAnimation(STANDINGSTILL);
C) if(%currentMouseX==%lastMouseX) && if(%currentMouseY==%lastMouseY)
%this.playAnimation(STANDINGSTILL);
D) if(%currentMouseX==%lastMouseX && %currentMouseY==%lastMouseY)
%this.playAnimation(STANDINGSTILL);
And all bugged.
Would something like this give or take a parenthesis or "==" mark work?:
E) if(%currentMouseX=0) && if(%currentMouseY=0)
%this.playAnimation(STANDINGSTILL);
What do you recommend for #2 about putting in Y parameters to keep moving the mouse left and right free of causing the top & down pics to flicker at the slightest increase or decrease of the Y?
01/30/2009 (9:30 am)
I'm not near my cpu with TGB, so I can't test it out right now. But I did try a similar solution earlier and it came up buggy.Where you've got:
}
else //handle no movement here
{
//put your no movement state here!
}
I put in for the handle:
A) if(%currentMouseX=%lastMouseX) && if(%currentMouseY=%lastMouseY)
%this.playAnimation(STANDINGSTILL);
B) if(%currentMouseX=%lastMouseX && %currentMouseY=%lastMouseY)
%this.playAnimation(STANDINGSTILL);
C) if(%currentMouseX==%lastMouseX) && if(%currentMouseY==%lastMouseY)
%this.playAnimation(STANDINGSTILL);
D) if(%currentMouseX==%lastMouseX && %currentMouseY==%lastMouseY)
%this.playAnimation(STANDINGSTILL);
And all bugged.
Would something like this give or take a parenthesis or "==" mark work?:
E) if(%currentMouseX=0) && if(%currentMouseY=0)
%this.playAnimation(STANDINGSTILL);
What do you recommend for #2 about putting in Y parameters to keep moving the mouse left and right free of causing the top & down pics to flicker at the slightest increase or decrease of the Y?
#13
I might be misunderstanding you .. but you don't have to write the test for the non-movement, since it's the opposite of the if test at the top.
=============================
As for #2 It's possible that you just don't have enough animations to make the transitions smoothe yet. Alternatively you can build in a delay with a schedule to only change every .5 seconds or something. Another idea is to have each image quickly FADE into the next giving it a morphin transition. I've written things like this that fade between images.. I suggest using a shedule method which calls it's self and changes the alpha values until it fades away. there are examples of this on the forums.. I guess I'm not really sure how you want it to.
Finally, you could make your actual image rotate and reposition to make it "dangle" off the mouse. the trick to the dangle technique is pretty cute..
But first I'll explain the problem you will face. Durring rotation you will find that it will rotate in the middle of your character and not from the point the mouse has it.. assuming you are dangking it under the mouse. But if you simply make the image twice as tall, the rotation will be at the top of his head.. then you need to write a nice smooth algorith for making the dangling look realistic.
Using a combination of these techniques will probably be best.
01/30/2009 (10:59 am)
um I wrote the code.. psudo code for that.. you don't have to test it again. that ELSE statement follows from the top.. it should read likeif($lastMousePosition!=%worldPosition) //this says if it moved do it.
{
... lots of code here
}
else // this goes if nothing moved
{
so now I can play my wait animation in here
}I might be misunderstanding you .. but you don't have to write the test for the non-movement, since it's the opposite of the if test at the top.
=============================
As for #2 It's possible that you just don't have enough animations to make the transitions smoothe yet. Alternatively you can build in a delay with a schedule to only change every .5 seconds or something. Another idea is to have each image quickly FADE into the next giving it a morphin transition. I've written things like this that fade between images.. I suggest using a shedule method which calls it's self and changes the alpha values until it fades away. there are examples of this on the forums.. I guess I'm not really sure how you want it to.
Finally, you could make your actual image rotate and reposition to make it "dangle" off the mouse. the trick to the dangle technique is pretty cute..
But first I'll explain the problem you will face. Durring rotation you will find that it will rotate in the middle of your character and not from the point the mouse has it.. assuming you are dangking it under the mouse. But if you simply make the image twice as tall, the rotation will be at the top of his head.. then you need to write a nice smooth algorith for making the dangling look realistic.
Using a combination of these techniques will probably be best.
#14
Problem is that the 3D still images are large, even after being chopped down and put onto two optimized .png animation sheets.
This game is going to have three cut scenes plus I haven't added the parts that are interacted with or the sound effects & background music.
So with all this I'm looking to trim where I can, plus making the character incredibly fluent(rag doll style like you've suggested) would expose how non-fluent he is in the cut scenes.
So code seems like the best alternative. Is there a way to setup boundaries for Y within the left and right movement to not trigger the image unless Y's change from the previous Y is greater than a specified increment like .2?
if(%currentMouseX<%lastMouseX) && (%currentMouseY<%lastMouseY) by less than .2 || (%currentMouseY>%lastMouseY) by less than .2
{
%this.playAnimation(MOVELEFT)
Because as it stands, the slightest nudge in a Y direction while scrolling Left or Right makes it flicker the up or down direction, sort of like the text example below.
<<<<^<<<<<^<<<<<
01/30/2009 (12:22 pm)
On 1#, I actually have multiple images for all movements (about 3 each that can double to 6 when you use the create cell animation tool).Problem is that the 3D still images are large, even after being chopped down and put onto two optimized .png animation sheets.
This game is going to have three cut scenes plus I haven't added the parts that are interacted with or the sound effects & background music.
So with all this I'm looking to trim where I can, plus making the character incredibly fluent(rag doll style like you've suggested) would expose how non-fluent he is in the cut scenes.
So code seems like the best alternative. Is there a way to setup boundaries for Y within the left and right movement to not trigger the image unless Y's change from the previous Y is greater than a specified increment like .2?
if(%currentMouseX<%lastMouseX) && (%currentMouseY<%lastMouseY) by less than .2 || (%currentMouseY>%lastMouseY) by less than .2
{
%this.playAnimation(MOVELEFT)
Because as it stands, the slightest nudge in a Y direction while scrolling Left or Right makes it flicker the up or down direction, sort of like the text example below.
<<<<^<<<<<^<<<<<
#15
for a very simple example, go to google maps and pick up the street view guy and drag him around the map. He only has 3 images, but it works very well. Unless the smooth animations are paramount to your gameplay, I wouldn't dig too deep on it, instead focus on your core gameplay.
I still haven't heard how this game is going to work so I don't know how important it is that you map every direction right.
Ah, I just thought of you you would do this smoothely, but you won't like it... maybe you will if you like doing tedious artist stuff: You create quck animations between each transition, so left, to down woould have an animation between them. then when you are running the animation, lock out your "updatePlayrMovement" function while it's animating. Then you will have your "transition time" you wanted, and the time will be spent with a nice animation. you would loose your fidgeting.. you have to lock out the updatePlayerMovement function otherwise your animations would be fighting eachother as you move it.
01/30/2009 (1:02 pm)
Yes, with programming.. ANYTHING is possible :D. There are a lot of ways you could do this. The best results would probably be to integrate box2d into your game, and create your ragdoll that way. I would actually suggest this option though. Since gravity is always going to be pulling down on your guy, throw out the drag down, and up options and just try the drag right and left animations you have.. and the still animation too (slight swinging.. or fidgeting). You may find that you get the effect you are looking for by reducing the other "up, down, up/right, down/left etc. for a very simple example, go to google maps and pick up the street view guy and drag him around the map. He only has 3 images, but it works very well. Unless the smooth animations are paramount to your gameplay, I wouldn't dig too deep on it, instead focus on your core gameplay.
I still haven't heard how this game is going to work so I don't know how important it is that you map every direction right.
Ah, I just thought of you you would do this smoothely, but you won't like it... maybe you will if you like doing tedious artist stuff: You create quck animations between each transition, so left, to down woould have an animation between them. then when you are running the animation, lock out your "updatePlayrMovement" function while it's animating. Then you will have your "transition time" you wanted, and the time will be spent with a nice animation. you would loose your fidgeting.. you have to lock out the updatePlayerMovement function otherwise your animations would be fighting eachother as you move it.
#16
1) How do I actually install/compile the program or is just snippets of code that I add to my gamescripts, behaviors, etc.?
2) Which ones do I need to add to my player code to create the effects you're mentioning?
I'm running into some bugs with the last bit of code you provided that start as soon as it gets to the first function:
"function sceneWindow2D::onMouseMove... "
I know you said it was Pseudo-code, and I'll try to find the necessary parts via the net.
3) As a backup to the box2d effect, which will take some time to figure out although I can tell it's definitely a bonus to have, I was thinking to do MouseMoveLeft triggers 15 degree rotation to the left and the versa vice for MouseMoveRight.
I'm guessing that doing that code will lead to another flicker of images that jumps directly from the STAND STILL to the 15 degree image.
Is there a way to create an ease into 20 degrees(other than with animated stills?). As you scroll left it keeps increasing the rotation until it tops out at 20 degrees? Which Box2d script does this?
01/30/2009 (4:02 pm)
So I've got Box2d downloaded and from the looks of it, it's a collection of script files.1) How do I actually install/compile the program or is just snippets of code that I add to my gamescripts, behaviors, etc.?
2) Which ones do I need to add to my player code to create the effects you're mentioning?
I'm running into some bugs with the last bit of code you provided that start as soon as it gets to the first function:
"function sceneWindow2D::onMouseMove... "
I know you said it was Pseudo-code, and I'll try to find the necessary parts via the net.
3) As a backup to the box2d effect, which will take some time to figure out although I can tell it's definitely a bonus to have, I was thinking to do MouseMoveLeft triggers 15 degree rotation to the left and the versa vice for MouseMoveRight.
I'm guessing that doing that code will lead to another flicker of images that jumps directly from the STAND STILL to the 15 degree image.
Is there a way to create an ease into 20 degrees(other than with animated stills?). As you scroll left it keeps increasing the rotation until it tops out at 20 degrees? Which Box2d script does this?
#17
1)To answer your question, the information about how to install the box2d stuff is on another thread. If you search for box2d you should find it.
2)I have never used Box2d, so I don't know what methods to use, but I assume the forums explain this.
3)Yeah, you can do things that rotate slowly. I did a pretty cool trick that you might be interested in doing, but first make sure that the smooth movement is a MUST for your games, since you could be spending alot of time on something that only minimally effects gameplay and takes alot of time to implement:
You can take your 2d images and put it into 3d Studio Max. Stick them togeather on a bone structure, then animate all the differences, and save the animations. How all your 2d images will move realistically with the animations, Then you can interpollate between the animations creating smoothe movements. To give you an example of sorts, look at an old game I was working on.. notice how I aim and the characters arms move fluidly holding the rifle. This was done by indexing a portion of an animation based on the angle between the mouse and my character. Pretty smoothe huh? And I used a 3dsMax animation to do this!
www.youtube.com/watch?v=0th7qd-TYvI
so even if you don't use the 3dsmax animation technique as I have shown, you can still relate an angle-rotation to your mouse direction.
02/02/2009 (11:14 am)
Sorry for the late reply, was out of town this weekend with no interTubes! 1)To answer your question, the information about how to install the box2d stuff is on another thread. If you search for box2d you should find it.
2)I have never used Box2d, so I don't know what methods to use, but I assume the forums explain this.
3)Yeah, you can do things that rotate slowly. I did a pretty cool trick that you might be interested in doing, but first make sure that the smooth movement is a MUST for your games, since you could be spending alot of time on something that only minimally effects gameplay and takes alot of time to implement:
You can take your 2d images and put it into 3d Studio Max. Stick them togeather on a bone structure, then animate all the differences, and save the animations. How all your 2d images will move realistically with the animations, Then you can interpollate between the animations creating smoothe movements. To give you an example of sorts, look at an old game I was working on.. notice how I aim and the characters arms move fluidly holding the rifle. This was done by indexing a portion of an animation based on the angle between the mouse and my character. Pretty smoothe huh? And I used a 3dsMax animation to do this!
www.youtube.com/watch?v=0th7qd-TYvI
so even if you don't use the 3dsmax animation technique as I have shown, you can still relate an angle-rotation to your mouse direction.
#18
From there I've put in the place holders for the shifting backgrounds along with a follow Camera control on the mouse for a cool depth effect.
The next thing is setting up the trigger objects that the character grabs, but before that I'm doing the tutorials on Animation Master, the new AFFORDABLE 3d program I just switched to, to get my barrings with that software before doing anymore stuff on this current game project.
You can also do the bone structure animation in Flash CS4, and I'll probably do something like that a few projects down the road.
I saw most of your YouTube collection and you've definitely got some stuff going on there. It looks like you've put a lot of work into your "Crackle Pop" game.
When's it slated for completion? How much time have you put into it? Is it something you plan on releasing for free or a fee?
02/03/2009 (5:35 pm)
Shortly after my last post, I realized I need to keep it simple for now and I'm going with just the FOLLOW MOUSE with a 10 frame looped float animation along with a grab animation.From there I've put in the place holders for the shifting backgrounds along with a follow Camera control on the mouse for a cool depth effect.
The next thing is setting up the trigger objects that the character grabs, but before that I'm doing the tutorials on Animation Master, the new AFFORDABLE 3d program I just switched to, to get my barrings with that software before doing anymore stuff on this current game project.
You can also do the bone structure animation in Flash CS4, and I'll probably do something like that a few projects down the road.
I saw most of your YouTube collection and you've definitely got some stuff going on there. It looks like you've put a lot of work into your "Crackle Pop" game.
When's it slated for completion? How much time have you put into it? Is it something you plan on releasing for free or a fee?
#19
Let me know if you need help with the trigger stuff. I'm helping another guy with setting up dynamic triggers, as it turns out. You can probably just follow that post actually.
As for cracklepop, it's been going for a few months (8ish I think). I will release a free version first. If it gets big then I will consider making a better version and charging for it. It's a multiplayer game, and I'm getting excited about getting a good Alpha version out in the next few months. I doubt I will have a final version 1 out before the end of the year, but you never know.
talk to you later!
02/03/2009 (6:26 pm)
"I realized I need to keep it simple for now". I'm glad you came to that conclusion. Doing, no more then a couple frames for right, left, and not moving, should be enough. Like the google maps "streetview" guy. Focus your time on making your gameplay tight and fun, and you will have spent your time wisely.Let me know if you need help with the trigger stuff. I'm helping another guy with setting up dynamic triggers, as it turns out. You can probably just follow that post actually.
As for cracklepop, it's been going for a few months (8ish I think). I will release a free version first. If it gets big then I will consider making a better version and charging for it. It's a multiplayer game, and I'm getting excited about getting a good Alpha version out in the next few months. I doubt I will have a final version 1 out before the end of the year, but you never know.
talk to you later!
#20
I haven't been able to narrow it down to the "Trigger Thread" you mentioned using the SEARCH FORUMS & SEARCH SITE tools (it's a common word and therefore has tons of threads).
02/04/2009 (12:11 pm)
What's the link to the trigger thread in case I have problems using only the tutorials?I haven't been able to narrow it down to the "Trigger Thread" you mentioned using the SEARCH FORUMS & SEARCH SITE tools (it's a common word and therefore has tons of threads).
Torque Owner Nic Biondi
Default Studio Name
If you want it to just play an animation based on where the mouse is moving that shouldn't be too hard. Just put some code in the "onMouseMove" callback and have a function that sees if the x or y values have changed. Then you can test to see if the x and y values are greater or smaller then before.. then you can play an animation for each case.
The other way of making him move to follow your mouse is going to be a delayed "onMouseMove" callback similar to what I described above, except that you will want to test the players x,y values relative to the mouse.. just as easy really.