This is part four in a series of 5 posts showing how I built a simple game in Silverlight, you can follow along (reading the posts in order) to build your own Traffic Jam game. I would recommend that you also go through ScottGu?s silverlight tutorials as well as the other tutorials on www.silverlight.net In part 3 we finished the level generation, now we are getting ready to move the cars around a little. 1. Add EventHandlers for MouseLeftButtonDown, MouseMove and MouseLeftButtonUp on the cars Add the following eventhandlers for mouse events in the AddCar method c.MouseLeftButtonDown += new MouseButtonEventHandler(OnCarLeftButtonDown); c.MouseMove += new MouseEventHandler(OnCarMove); c.MouseLeftButtonUp += new MouseButtonEventHandler(OnCarLeftButtonUp...(read more)
Go to the complete details ...