I have not been able to run GameMaker (or "Game Maker", as it used to be called) using VirtualBox on Ubuntu 12.04, since GameMaker uses DirectX and not OpenGL. Similar problems may occur for VMWare.
A game engine that is similar to GameMaker, but FOSS, is ENIGMA Development Environment: [url="http://enigma-dev.org"]enigma-dev.org[/url]. It is licensed under the GPLv3, and it supports Linux, Windows and Mac OS X. It currently has problems with working on Ubuntu 12.04, but the developers are working to support it. I have personally run the enigma-jdi branch (see https://github.com/enigma-dev/enigma-dev) with little trouble on Ubuntu 12.04. ENIGMA has an IDE, a scripting language, an object editor, a room editor and many other things that makes it much easier to develop simple 2D games. It is not so good with 3D games (although it can be done in it), but since you are seeking a 2D game engine that should not be a problem. And I have not had any problems getting ENIGMA to run in Windows using VirtualBox, because ENIGMA uses OpenGL, so if you don't want to use the enigma-jdi branch, you can always use it on Windows on VMWare.