This project has moved and is read-only. For the latest updates, please go here.

Can it be use for a Surface game ?

Jan 16, 2012 at 6:09 PM

Dear all,

I am building Surface application for my customers and one of them ask me to build a small game for his customers.
First I was thinking of a famous multiplayer hair Hockey or  small brik wall.

Trickiy part is the collision of element of course.
For instance for Air hokey, player pas can be nothing else than custom scatterViewItems and then the Puck is the central point where coision should be handle between player pad.

Do this library can be easily implemented for such small game ?

An other exemple project I have in mind a multiplyer brick wall, where when the brick is hit with the ball then it should desapears.

Does all this can be done with this library ?

Any sample for that case ?



Jan 18, 2012 at 8:22 PM

Xaml Physics will work in s surface application. Just be sure to use TouchDrag instead of MouseDrag to enable dragging elements.

There is a sample that shows you have to handle collision events. You can view it here

Also there was a discussion on how to add and remove bodies at run time a while ago here

Jan 19, 2012 at 6:49 AM
Edited Jan 19, 2012 at 6:51 AM

SergeCalderara , Liserdarts doo and awesome job!
Make a game like the 2 players classic pong is possible in extreme easy way.
Can be developed with this lib in just few minutes is extreme easy !!
I plan use the lib for specific thing i need, but i plan soon try create dual layer  pong game just for fun : )

Jan 19, 2012 at 7:56 AM

GrobotoX, If it really takes few minutes can you show be a small sample of those basic pong ? either I am stupid or blind but could not find the right way

Jan 19, 2012 at 8:43 AM
Edited Jan 19, 2012 at 8:50 AM

I cant do right now due I  stay ultra bussy, but if you can wait one week or less, yes, i can do very basic and you can see how easy can be.
I can do this over the weekend, very ultra basic but working example.

I code in C#  is ok for you?

If not I can create the basic on xaml and you can complete the code in visualbasic or any .net you use.

Jan 19, 2012 at 9:05 AM

I send something in few minutes  :  )

Jan 19, 2012 at 9:24 AM

Yes I am using C#

Thnaks for your help anyway


Jan 19, 2012 at 9:45 AM
Edited Jan 19, 2012 at 10:01 AM

I know this no is a complete game but is the basic of how the lib work. I don't know why some times the ball when go to border not bounce and only roll from the border. Liserdarts can explain why when he have some free time.
Solving that problem you can start from here.

You can start from here :)
I plan build a complete 2 players game very soon, right now not have free time.


        xmlns:mc=""  x:Class="test.MainWindow"
        WindowStyle="None" WindowStartupLocation="CenterScreen"
        Title="MainWindow" Height="600" Width="1024" Loaded="Window_Loaded">

    <Grid Margin="-7.962,-8.005,-8.038,-7.995" Background="Black">
        <Rectangle Fill="#FFF4F4F5" Margin="497.208,0,0,0" Stroke="Black" HorizontalAlignment="Left" Width="10.855" Opacity="0.425"/>
        <physics:PhysicalBox x:Name="UxBox" Width="1024" Margin="0,0,0,8" >
                <physics:GameLoop />
            <physics:TouchDrag Width="1024" Height="600" OpacityMask="White">
                    <Ellipse Canvas.Left="209.117" Canvas.Top="169.302" Fill="#FF71FF00" Height="47" x:Name="ellipse1" Stroke="Black" Width="47" SourceUpdated="ellipse1_SourceUpdated" >
                            <physics:CircleBody IgnoreGravity="True" />
                    <Rectangle Canvas.Top="-0.018" Width="1016" Height="8.748" Fill="White" OpacityMask="White">
                        <physics:RectangleBody IgnoreGravity="True" IsStatic="True"  />
                    <Rectangle Canvas.Top="590.906" Width="1016" Height="8.748" Fill="White" OpacityMask="White">
                    		<physics:RectangleBody IgnoreGravity="True" IsStatic="True"  />
                    <Ellipse Canvas.Left="18.892" Canvas.Top="239.386" Fill="Black" Height="122.088" x:Name="stick1" Stroke="White" Width="122.088" SourceUpdated="ellipse1_SourceUpdated" StrokeThickness="7" >
                    		<physics:CircleBody IgnoreGravity="True" />
                    <Ellipse Canvas.Left="859.876" Canvas.Top="239.386" Fill="Black" Height="122.088" x:Name="stick2" Stroke="White" Width="122.088" SourceUpdated="ellipse1_SourceUpdated" StrokeThickness="7" >
                    		<physics:CircleBody IgnoreGravity="True" />


Jan 19, 2012 at 10:03 AM

All what you need is fire collision event when the ball touch some black hidden rectangle in the back of CIRCULAR STICKS, just locate 2 rectangles and turn static, and fire collision event form that objects.

You can use that for create punctuation, make ball disappear, and create a new ball.

Thats if im not have your game : )

Jan 19, 2012 at 12:46 PM
Edited Jan 25, 2012 at 10:44 PM


I have give a try to what you mention but I am not able to move any element, anything wrong ?

An other thing is that TouchDrag is not define in the assembly !!!!



Feb 9, 2012 at 4:36 PM

A new TouchDrag class is coming. Also a TagDrag Class specifically for Surface. I already made an airhockey game for Surface here:

I think the old TouchDrag is in this discussion group somewhere...

Feb 11, 2012 at 12:00 AM

TouchDrag has not been part of a release yet but it is in the source.

It will be part of 0.7 when it comes out.