Preface
In this guide I'll be teaching you how to make a Doodle Jump like game, will it be 100% accurate, no. Is the game programmed like this, I do not know.
Anyways, this guide should work for Windows, MacOS and Linux programmers, FreeBSD probbaly would work with the Linuxulator (maybe, I really do not know).
This expects you know a little bit about programming, like the basic terms of classes, intgers, etc. But you don't have to be a 30 senior dev to follow this (lord knows I am not one).
I have sorted some words, in sompe places to save space. So GraphicsDeviceManager is GDM, SpriteBatch is SB.
I used MonoGame, however this should work the same for FNA and XNA expect some minor differences.
Getting Started!
So we need to create a MonoGame project, we'll be using the Desktop OpenGL project, this support Windows, Mac, and Linux. If you're on Windows you can also use desktop-gx, but desktop-gl is better. The only difference for you the dev is how shaders and effects are programmed (but we do not those). But just use desktop-gl, okay?
Run this (-n just speificies your of your game) your terminal, cmd, etc.
dotnet new mgdesktopgl -n DaleJump
Open it with whatever editor you want to use, I use vs-codiuim, but you can use neo-vim, notepad++, whatever
And onto the game proper!
Creating The Platfrom Logic
For now we are going to stick with untextured sprites, we we'll need to make a Texture2D and then set that to the colour white, and make it 1x1. This will be used when we draw the platfroms. We'll also delcare the game res we want (I just did 800x600).
private GraphicsDeviceManager _graphics; private SpriteBatch _spriteBatch; public Texture2D blankTexture;// I prefer to declare textures under SB and GDM, but you do you! int gameResWidth = 800; int gameResHeight = 600;
public Game1() { _graphics = new GraphicsDeviceManager(this); _graphics.PreferredBackBufferWidth = gameResWidth; _graphics.PreferredBackBufferHeight = gameResHeight; Content.RootDirectory = "Content"; IsMouseVisible = true; }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); blankTexture = new Texture2D(GraphicsDevice, 1, 1); blankTexture.SetData(new[] { Color.White }); }
Now we have a texture!