SpriteHand
Module Border
  Most recent blog entries
Module Border
Collision Detection on Windows Phone 7
Andy's Blog By Andy Beaulieu on 9/27/2010 4:24 PM

If you're using Silverlight on Windows Phone 7 for casual games development, performing a HitTest to determine if two elements collide is a basic need. I've blogged about how to do this in desktop Silverlight in the past, and for the most part this technique works great in WP7... EXCEPT when your app is running in Landscape orientation.

[DOWNLOAD SOURCE]

The problem in WP7 is that FindElementsInHostCoordinates will always return elements in portrait orientation, so that they are rotated 90 degrees from the top left origin. We can work around this using a RotateTransform to determine what point we want to test.

public static Point HackPointForWindowsPhoneLandscape(Point pt)

{

    double angle = 90;

    Point ptOrigin = new Point(0, 0);

 

    RotateTransform rt = new RotateTransform();

    rt.Angle = angle;

    rt.CenterX = ptOrigin.X;

    rt.CenterY = ptOrigin.Y;

    Point ptReturn = rt.Transform(pt);

 

    ptReturn.X = ptReturn.X + 480;

 

    return ptReturn;

}

In the download sample, the CollisionHelper class wraps this hack all up for you. You just need to use the CheckCollision method to see if two elements collide:

if (CollisionHelper.CheckCollision(ship, shipShell, asteroidXaml1, pathAsteroid1))

{

    txtStatus.Text = "Collision with XAML Element!";

    return;

}

 

That's it! This gives us pixel-perfect collision detection with pretty good performance.

Comments (2)

Talking Ragdoll for Windows Phone 7
Andy's Blog By Andy Beaulieu on 9/11/2010 5:19 PM

One of the suggestions I repeatedly heard for Boss Launch 2: Zombie Attack was the ability to customize the head for the Boss, so that you could stick your own boss’s head on the unlucky projectile. As I was working on getting this feature into the game, I began thinking that this would make for a great stand alone physics toy!

And so was born “Talking Ragdoll” – my third entry into the upcoming Windows Phone 7 Marketplace. I think this is really a fun time waster (and may actually have some real utility in that it allows for some great photo editing!)

Talking Ragdoll Features:

  • Ragdoll repeats whatever you say, in a funny voice.
  • Realistic physics – drag your ragdoll around and pose it any way you like.
  • Throw beer bottles, eggs, grenades and tomatoes at your doll, with realistic effects.
  • Paint on your ragdoll with the paint brush.
  • Several high quality Heads, Bodies, and Scenes to choose from.
  • Import your own pictures and use them as the ragdoll’s head!
  • Take a snapshot of your scene and save it to your phone.

In some upcoming blog posts I’ll explore some of the techniques I used in the game such as audio capture. As always, I look forward to any comments or suggestions.

Comments (4)

DroppyPop for WP7 Update
Andy's Blog By Andy Beaulieu on 8/26/2010 10:15 PM

Yes it's a little early to be thinking about the Holidays, but with the final release of the Windows Phone 7 tools imminent, we can bet that shiny new WP7 devices will be in many stockings this year. My hobby hours have been consumed with getting a couple of games ready for launch, and I was able to get a loaner LG prototype for a week which provided a great sanity check. I can tell you that the emulator is really a fantastic representation of the final device, the only caveats being performance and feel of the accelerometer input (one thing I caught immediately was that I had reversed one of the Accelerometer Axes in my code!).

As I mentioned before, I am creating both a Web and WP7 version of DroppyPop, which is great because it allows people to test the game and give feedback before the release of WP7. I'd like to thank everyone for all of the feedback so far - I have incorporated many of your ideas and fixes!

DroppyPop Update

Today I released an update to DroppyPop, which for a limited time unlocks all rag dolls and power-ups! (The final release will have a Trial version which will only unlock one rag doll and disable all power-ups). There is also new game play and new power-ups to look out for in this version.

If you have a few moments of casual gaming time, then please give this new version a try - I look forward to your feedback.

If you find a bug or have an idea, please let me know by either:

  • Adding a comment to this blog post
  • Using the "Feedback/Bugs" link inside the Game, under Options.


Mrs. Claus, one of the new rag dolls in DroppyPop

Comments (1)

Boss Launch 2: Zombie Attack for WP7
Andy's Blog By Andy Beaulieu on 6/18/2010 1:40 PM


Here is a sneak peak of another little project I'm working on for Windows Phone 7, in addition to DroppyPop:

This is the much-awaited sequel to Boss Launch, titled "Boss Launch 2: Zombie Attack" - in which you use your (normally useless) boss to take out a Zombie horde as you progress through many challenging levels. Things get interesting when you interact with vehicles (such as jumping into the back of a truck).

Unfortunately, I have no idea how this game performs on an actual device, so I may have to trim back some of the effects and number of objects in the end.

Yes, like so many other developers, I could really use a Windows Phone 7 device to test performance on!

Interested in game development for Windows Phone 7 using Silverlight? Check out these other posts:

Coding4Fun: Shuffleboard Game for WP7

Droppy Pop: A Windows Phone 7 Game

WP7 Back Button in Games

WP7 + Silverlight Performance

Comments (3)

Coding4Fun: Shuffleboard Game for WP7
Andy's Blog By Andy Beaulieu on 6/15/2010 6:15 PM

 

UPDATE 7/14/2010: The source code has been updated for Windows Phone 7 Beta Tools (July 2010)

My Coding4Fun article "Creating a Shuffleboard Game in Silverlight for Windows Phone" has been posted! 

[VIEW TUTORIAL]

[TRY THE GAME]

[DOWNLOAD SOURCE]

This tutorial includes a video walkthrough showing step-by-step creation using Visual Studio 2010 and Expression Blend 4. You'll learn about Physics Behaviors, Perspective Transforms, Gestures, and Multitargeting among other things.

Below are links to the videos for a quick reference:

Part 1: Getting Started

Part 2: Designing the Table

Part 3: Player Turns and Table Rotation

Part 4: The Game Loop + Targeting Windows Phone 7

Part 5: Sound Support

Part 6: Performance

Comments (1)

WP7 Back Button in Games
Andy's Blog By Andy Beaulieu on 6/14/2010 6:35 PM

In order to publish a Windows Phone 7 application on the Marketplace, your app must pass a list of certification requirements. One of the items in the Windows Phone 7 Certification Requirements caught my eye:

5.2.4 Use of Back Button in Games

a. Pressing the Back button from the first screen of a game must exit the application.

b. During gameplay, pressing the Back button in games must present an in-game menu. This menu must offer the option to resume the game. Pressing the Back button while this menu is up must exit the game. Microsoft recommends that you save the user game state or warn them of possible progress loss before exiting the game).

c. Outside gameplay (for example, when the user is viewing the options or help menu), pressing the Back button must return to the previous menu or page.

In order to conform to this requirement in a Silverlight game, we can override the OnBackKeyPress event of a PhoneApplicationPage, and if the game is playing we can present the user with a "pause menu" allowing them to resume or exit the game. Here is an example of an OnBackKeyPress override that I'm using to show an in-game menu.

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)

{

 

    if (ucMainGame1.GameState == ucMainGame.GameStates.Playing)

    {

        e.Cancel = true;

        ucMainGame1.PauseGame();

    }

           

}

To stop our app from closing due to the back button key press, we just set e.Cancel to true.

That's all there is to it. If your app has some deeply nested screens, for options and such, you will likely want to navigate to the screens using a NavigateUri property of a Hyperlink control. This way, the back button will take you back to previous pages and fulfill requirement 5.2.4.c.

 

Comments (7)

Shuffleboard: A Windows Phone 7 Sample Game
Andy's Blog By Andy Beaulieu on 5/27/2010 6:39 AM

Today I uploaded a Windows Phone 7 sample game to codeplex which demonstrates physics, gestures, perspective transforms, multitargeting, sound and GPU acceleration.

[TRY THE GAME]

[DOWNLOAD SOURCE]

This Shuffleboard game was created as the basis for a Coding4Fun tutorial, which will be available soon on the C4F Website. I don't want to spoil the fun for the official tutorial release so I won't go into much detail here, but this demo should be helpful for folks wanting to quickly create physics based games for the upcoming Windows Phone 7 devices.

When the tutorial is released, it will include a video walkthrough showing step-by-step creation using Visual Studio 2010 and Expression Blend 4. Look for updates on the release, but in the meantime here are some more resources for creating physics-based games in Silverlight:

Windows Phone 7 Developer Tools Install Info (Tim Heuer)

Physics Games in Silverlight on Windows Phone 7

Windows Phone 7/Silverlight Performance

Windows Phone 7 Developer Portal

How To: Handle Manipulation Events

Forums on Silverlight.net

Forums on WindowsPhone

 

Comments (6)

Droppy Pop: A Windows Phone 7 Game
Andy's Blog By Andy Beaulieu on 5/10/2010 7:48 PM

ME:  I've been working on an idea for a Windows Phone 7 game and I'd really like your feedback and ideas.

YOU: But I don't have a Windows Phone 7 device yet. I've been looking under bar stools but all I find are iPhone's.

ME: How about this? Since the game is written using Silverlight, why don't I just give you a link to a Silverlight Web version of the game, which uses the same source code, and you can give that a go?

In DroppyPop, you control a rag doll which is falling through an endless sky of balloons. Pop as many balloons as you can for points while avoiding the bombs and baddies along the way.

I've been developing DroppyPop using the methods I described in a previous blog post, namely using multi-targeting to create both a Silverlight Web version and a Windows Phone 7 version using the same source code. I develop about 90% of the time in the Silverlight Web project, and then use Linked Files from a Windows Phone 7 project to build a version for WP7. This has a couple of major advantages:

  • It's faster to compile and run outside of the WP7 emulator
  • You end up with both a Windows and Web version

This method has been working great for me, and there are only a few instances where I need to use compiler directives to use different logic for the two platforms. This is possible because Microsoft did a fantastic job on the port of Silverlight for the Phone!

Your Feedback... Please!

Let me know what you think of DroppyPop. Does the concept work? Are there any bugs? Would you pay 99 cents for the full version? :)

You can leave feedback here in the comments, or inside the game under Options/Feedback.

Comments (13)

Obfuscating Silverlight (for free)
Andy's Blog By Andy Beaulieu on 4/15/2010 5:39 PM

You might be aware that when you publish a Silverlight XAP on the web, your source code is very vulnerable to prying eyes. A XAP file is in a ZIP compressed format, and the contents are .NET Assemblies and resources which can be disassembled easily using a tool like .NET Reflector . Although there is no sure-fire way to stop someone from copying your Silverlight application logic, obfuscation can at least make it a bit more difficult to hack through.

Babel Obfuscator for .NET

There are a few obfuscators out there that support Silverlight, but they can be pricey. However, Babel Obfuscator started out as a community project and still maintains a freeware edition. Additionally, it appears that the new version of Babel has corrected some issues with obfuscating Silverlight assemblies.

Here is how you can use the free edition of Babel Obfuscator to encrypt your Silverlight assemblies: (I should mention, if you do have $149 laying about, I recommend buying the Pro version of Babel which has XAP support)

1.       Download the Free edition of Babel Obfuscator.

2.       Download the Free 7-zip compression utility. We’ll need this to update the obfuscated assemblies in our Silverlight XAP file. If you are happier with a different ZIP utility, go ahead and use it instead.

3.       Inside your Silverlight solution, right-click the Silverlight project and select Properties.

4.       Go to the “Build Events” tab and add the following inside the Post-build event command line:

"C:\Program Files\Babel\babel.exe" $(TargetPath) --noildasm --nomsil --noinvalidopcodes

"C:\Program Files\7-Zip\7z.exe" a $(TargetDir)$(ProjectName).xap $(TargetDir)BabelOut\$(TargetFileName) -y -tZIP

This post-build event will run the Babel Obfuscator against your assembly, which places it into a “BabelOut” subdirectory. Then we use 7-zip to bring that updated, obfuscated assembly back into our XAP file.

Examining the Obfuscation

We can use a tool like .NET Reflector to see what the obfuscator does for us. Here is some example before-and-after code showing an example of the obfuscation.

BEFORE OBFUSCATION

    private bool IsRagDollPart(string part);
    private void LayoutRoot_KeyDown(object sender, KeyEventArgs e);
    private void LayoutRoot_KeyUp(object sender, KeyEventArgs e);
    private void MainPage_Loaded(object sender, RoutedEventArgs e);
    private void newObstacleExplode_Exploded(ucObstacle source);
    private void newObstacleExplode_Exploding(ucObstacle source);
    private void PositionBalloon(ucObstacle obstacle);
    private void PositionEnemy(FlyingEnemyBase enemy);
    private void PositionPowerUp(PowerupBase powerUp);
    public static double RadiansToDecimalDegrees(double radians);
    private void ResetLevel();
    private void ShieldActive(bool isActive);
    private void ucExplosion1_Exploded(ucExplosion source);
    private void ucMainGame_KeyDown(object sender, KeyEventArgs e);
    private void ucMainGame_KeyUp(object sender, KeyEventArgs e); 

AFTER OBFUSCATION

    private void (bool );
    private bool (string );
    private void (object );
    private void ();   
private
void (PowerupBase );
private void (bool );
    private void (ucObstacle );
    private void (ucExplosion );
    private void ();
    private void (ucObstacle );
    private void (ucObstacle );
    private void (PowerupBase );
    private void (FlyingEnemyBase );
    private void (object , KeyEventArgs );
    private void (object , KeyEventArgs );

 

Comments (12)

Windows Phone: Silverlight for Casual Games
Andy's Blog By Andy Beaulieu on 3/28/2010 5:58 PM

Thanks to everyone who attended my session at Code Camp 13 in Waltham, "Windows Phone: Silverlight for Casual Games." It's great to see so many people sharing my excitement for Windows Phone 7!

In this session, we talked about the new hardware, Silverlight support, the Emulator, GPU Acceleration, monitoring performance, Behaviors, sound support, input, and monetization of your games.

As promised, here are my slides and demos from the talk.

[DOWNLOAD SLIDES]   [DOWNLOAD DEMOS]

And here are some links to get you started with creating fun games with Silverlight for Windows Phone 7:

Install Checklist for Windows Phone Development

Windows Phone 7 Developer Portal

Physics Games in Silverlight on Windows Phone 7

Windows Phone 7/Silverlight Performance

How To: Handle Manipulation Events

Forums on Silverlight.net

Forums on WindowsPhone

 

Comments (2)

Module Border Module Border
Module Border
  Subscribe
Module Border
RSS   Twitter
Module Border Module Border
Module Border
  Diversions
Module Border


PHYSAMAJIG
This Windows app was created using Physics Helper XAML, and the Farseer Physics Engine.
DOWNLOAD

MORE INFO



TALKING RAGDOLL
This Windows Phone app was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine. It gets interesting when you import your friends photos and have your way with them!

MORE INFO



BOSS LAUNCH
This physics game won first place in the Server Quest Contest. Created using Silverlight , the Physics Helper Library,  and the Farseer Physics Engine.
PLAY IT

MORE INFO



DESTROY ALL INVADERS
A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight.
PLAY IT

INFO AND CODE



PHYSICS HELPER DEMOS
These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.
PLAY IT

INFO AND CODE



HOOK SHOT
This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight and the Farseer Physics engine.
PLAY IT

MORE INFO



SORT THE FOOBARS
A game where you need to sort the good foobars from the bad ones. Created using Silverlight and the Farseer Physics engine.
PLAY IT

MORE INFO



POLYGON PHYSICS DEMO
A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight and the Farseer Physics engine.
PLAY IT

MORE INFO



SILVERLIGHT ROCKS!
Destroy the asteroids before they destroy your ship! Created using Silverlight.
PLAY IT

INFO AND CODE



FISH GAME
A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.
PLAY IT

INFO AND CODE

Module Border Module Border
Module Border
  Search_Blog
Module Border
Module Border Module Border
Module Border
  Blog_Archive
Module Border
Module Border Module Border
Copyright (c) 2014 andy.beaulieu.com - Login
cheap Ralph Lauren shirts Ralph Lauren outlet Canada Goose jackets on sale cheap moncler jackets moncler jackets on sale moncler outlet canada goose outlet canada goose outlet canada goose outlet cheap ralph lauren shirts ralph lauren outlet ralph lauren outlet canada goose outlet canada goose outlet kanye west louis vuitton moncler outlet moncler outlet moncler outlet moncler outlet speedy louis vuitton canada goose outlet moncler outlet tiffany outlet moncler outlet speedy louis vuitton kanye west louis vuitton