TileMap – How To Get ALL The Tiles Effortlessly!

If you're building a 2D game in Unity3D, odds are you've come across the TileMap component. The TileMap is a powerful tool that allows you to create a grid of tiles that you can render your tiles with instead of hand-placing individual game objects with sprites. It has a host of built in functionality that you might otherwise find yourself manually writing, like mapping coordinates to particular cells on a map. And what's even cooler about using a TileMap? You don't need to handroll your own editor to paint tiles! I think I'd pass on having to do that. But have you found yourself in a situation where you want to get all of the painted tiles on a TileMap? You may have found it's not quite as obvious as you'd have hoped! What We Have To Work With On…

0 Comments

IronPython: A Quick WinForms Introduction

A few months ago I wrote up an article on using PyTools, Visual Studio, and Python all together. I received some much appreciated positive feedback for it, but really for me it was about exploring. I had dabbled with Python a few years back and hadn't really touched it much since. I spend the bulk of my programming time in Visual Studio, so it was a great opportunity to try and bridge that gap when looking at something like IronPython. I had an individual contact me via the Dev Leader Facebook group that had come across my original article. However, he wanted a little bit more out of it. Since I had my initial exploring out of the way, I figured it was probably worth trying to come up with a semi-useful example. I could get two birds with one…

0 Comments

Dynamic Programming with Python and C#

Previously, I was expressing how excited I was when I discovered Python, C#, and Visual Studio integration. I wanted to save a couple examples regarding dynamic code for a follow up article... and here it is! (And yes... there is code you can copy and paste or download). EDIT: Wait! Before you head to far, you might want to check out this more recent article on Python and C#! What does it mean to be dynamic? As with most things, wikipedia provides a great start. Essentially, much of the work done for type checking and signatures is performed at runtime for a dynamic language. This could mean that you can write code that calls a non-existent method and you wont get any compilation errors. However, once execution hits that line of code, you might get an exception thrown. This Stack…

6 Comments

Simple Way To Structure Threads For Control

BackgroundI've previously discussed the differences between the BackgroundWorker and Thread classes, but I figured it would be useful to touch on some code. I'd like to share the pattern I commonly use when creating threads in C# and discuss some of the highlights.The Single ThreadI like to use this design when I have a single thread I need to run and in the context of my object responsible for running the thread, I do mean having a single thread. Of course, you could have your object in control of multiple threads as long as you repeat this design pattern for each of them.Here's the interface that I'll be using for all of the examples: internal interface IThreadRunner { #region Exposed Members void Start(); void Stop(); #endregion }Behold! internal class SingleThreadRunner : IThreadRunner { #region Fields private readonly object _threadLock; private…

0 Comments

End of content

No more pages to load