Skip to content

Instantly share code, notes, and snippets.

View Bocom's full-sized avatar

Benjamin Röjder Delnavaz Bocom

View GitHub Profile
@Bocom
Bocom / gist:561776
Created September 2, 2010 02:58 — forked from Kulag/gist:561709
use v5.10;
use Mojolicious::Lite;
get '/' => sub {
shift->render(layout => 'page', text => 'hello world!', title => 'test');
};
get '/index' => 'index';
app->start;
/// <summary>
/// Applies movement to the character based on input.
/// </summary>
/// <param name="gameTime">The current GameTime object.</param>
/// <param name="map">The current Map.</param>
private void ApplyMovement(GameTime gameTime, Map map)
{
float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
velocity = movement * speed; // movement = unit vector, int speed = 225
if (movement.X > 0)
currX = bounds.Right;
else if (movement.X < 0)
currX = bounds.Left;
if (movement.Y > 0)
currY = bounds.Bottom;
else if (movement.Y < 0)
currY = bounds.Top;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
@Bocom
Bocom / animation.yaml
Created June 9, 2012 14:50
An example animation file
texture: Link.png
size:
width: 32
height: 48
animations:
idle-down:
loop: true
frames:
0:
length: 1
@Bocom
Bocom / gist:2903036
Created June 9, 2012 23:30
An example animation file
{
"texture": "Link.png",
"size": {
"width": 32,
"height": 48
},
"animations": {
"idle-down": {
"loop": true,
"frames": [
@Bocom
Bocom / MessageQueue.cs
Created July 19, 2012 15:45
A message queue for XNA
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace WanderfulEngine
{
public struct Message
{
/// <summary>
public class DialogueTextChar
{
public Color color;
public String message;
public Vector2 position;
public bool shake;
public DialogueTextChar()
{
this.message = "";
private List<DialogueTextChar> constrainText(string message)
{
bool filled = false;
string line = "";
string returnString = "";
string[] wordArray = message.Replace("\n", "").Split(' ');
Color currentColor = Color.White;
bool recolor = false;
bool shake = false;
bool stopShake = false;
import clr
clr.AddReference("Wanderful")
clr.AddReference("WanderfulEngine")
clr.AddReference("Microsoft.Xna.Framework")
import Wanderful
from WanderfulEngine import InputManager
from Microsoft.Xna.Framework import Vector2
from Microsoft.Xna.Framework.Input import Keys