C# example to load Doom WAD file

using System; using System.IO; namespace waddy { class Program { static string GetString(byte[] arr) { return System.Text.ASCIIEncoding.ASCII.GetString(arr); } static void Main(string[] args) { Console.WriteLine("Hello World!"); if (File.Exists("DOOM.WAD")) { using (BinaryReader reader = new BinaryReader(File.Open("DOOM.WAD", FileMode.Open))) { string name = GetString(reader.ReadBytes(4)); int numberOfLumps = reader.ReadInt32(); int folderPosition = reader.ReadInt32(); reader.BaseStream.Seek(folderPosition, SeekOrigin.Begin); Console.WriteLine(name); Console.WriteLine("Contains " + numberOfLumps … Continue reading C# example to load Doom WAD file

Example of bouncing ball

var gameScreen = document.getElementById("gameScreen"); var context = gameScreen.getContext("2d"); context.fillStyle = "#FFFFFF"; context.font = "8px Sans-Serif"; context.fillText("Pong!", 10, 10); var ball = { x : 50, y : 50, width : 5, height : 5, x_direction : 1, y_direction : 1 }; var previousBall = ball; var boundary = { x1: 20, x2: 200, y1: 20, … Continue reading Example of bouncing ball