Skip to content

Looking at the Samples

debreuil edited this page Sep 14, 2010 · 9 revisions

These samples are all from the V2DTests project. The Flash files are in the Tests folder, and they compile swf into the content folder. Not all of them have their own screen files – that is only needed for specialized behaviour (which normally you would want). The screens are created in http://github.com/debreuil/Swf2XNA/blob/master/V2DTests/TestGame.cs

This screen shows two uses of distance joints – one attaches to the background, while the other keeps tow objects a fixed distance from each other. you only need to define objects you are interested in coding against, which in this case is none of them.

Notice if you press space, 3D spaceships appear! This is just to show its possible here, however 3D objects can be mapped to the 2D shapes fairly easily (much the same way 2DTextures are currently mapped in fact.

These are some sample usages of revolute joints. Notice how the one yellow element animates – this is simple playing the flash animation. Also if you look in the Flash file you can see how the yellow object is constrained visually – the second and third frame define the min and max angles it can rotate.

Gear Joints allow the movement of one object to control the movement of a second. Also, the two red flower and their joints are actually grouped in the Flash, which works fine : ).

Prismatic joints constrain elements along paths. Again the min and max values are defined in frames 2 and 3. These values can also be set on attributes of the joint declaration.

Pulley joints tie two elements together, when one goes down, the other goes up. Notice we have debugDraw turned on here, this is done on the class level attribute, debugDraw=true.

This is an example of a regular Flash animation. Note: things do NOT play by default here, they are stopped on frame one by default. Play by default makes sense in a non coding environment like the Flash IDE, however when creating files programatically itsbetter not not have anything happen that you didn’t make happen.

Lots of attribute usage in this one, they control the motors and rotation of various objects. These are some useful JSFL snippets to make these kinds of things in Flash (and autoname/number them).

This is just a generic sample with a bunch of stuff.

Another sample, this time a bridge and a seesaw. A game in the making there : ).

Clone this wiki locally