Skip to content

Instantly share code, notes, and snippets.

//in the game's preload function you load the image like any other
game.load.image('bkgrnd', 'sprites/background.png');
/*Then you add the tileSprite in create(). This constructor's parameters are, in order:
0 - position of the image on the X coordinate of the game
0 - position of the image on the Y coordinate of the game
640 - Width of the tile
480 - Height of the tile
bkgrnd - key you gave to the image when you loaded it in preload()
see: http://phaser.io/docs/2.4.4/Phaser.TileSprite.html */
@crowcoder
crowcoder / BasicGameIntegration
Last active January 26, 2019 15:56
BasicGameIntegration
<!doctype html>
<html>
<head>
<!-- stuff... -->
</head>
<body>
<div id="gameDiv"></div>
<script src="https://newupwaititsfun.z13.web.core.windows.net/frog/game.js" integrity="sha384-qoRzVFhcu3MPqU4+hUIAG45mJWAXYwf1QDlkHQY2519KjBjFyETk7mTDV/wY9AD1"
crossorigin="anonymous"></script>
</body>
using System;
using System.Collections;
using System.Collections.Generic;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
static void Main(string[] args)
{
SqlConnectionStringBuilder bldr = new SqlConnectionStringBuilder();
bldr.DataSource = "(localdb)\\DEV";
bldr.InitialCatalog = "DbParams";
bldr.ApplicationName = "ParameterBehavior";
bldr.IntegratedSecurity = true;
using (SqlConnection con = new SqlConnection(bldr.ConnectionString))
using (SqlCommand cmd = con.CreateCommand())
private static void InputWithNoDefault(SqlCommand cmd)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_Input_No_Default";
SqlParameter par = new SqlParameter("@param1", SqlDbType.VarChar);
par.Direction = ParameterDirection.Input;
par.Value = "Foo";
cmd.Parameters.Add(par);
}
CREATE PROCEDURE [dbo].[usp_Input_No_Default]
@param1 varchar(50)
AS
SELECT @param1;
RETURN 0;
private static void InputWithNoDefault_NullValue(SqlCommand cmd)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_Input_No_Default";
SqlParameter par = new SqlParameter("@param1", SqlDbType.VarChar);
par.Direction = ParameterDirection.Input;
par.Value = null;
cmd.Parameters.Add(par);
}
private static void InputWithNoDefault_DBNullValue(SqlCommand cmd)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_Input_No_Default";
SqlParameter par = new SqlParameter("@param1", SqlDbType.VarChar);
par.Direction = ParameterDirection.Input;
par.Value = DBNull.Value;
cmd.Parameters.Add(par);
}
CREATE PROCEDURE [dbo].[usp_Input_Has_Default]
@param1 varchar(50) = 'I''m a default value'
AS
SELECT @param1;
RETURN 0;
private static void InputNullWithDefault(SqlCommand cmd)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_Input_Has_Default";
SqlParameter par = new SqlParameter("@param1", SqlDbType.VarChar);
par.Direction = ParameterDirection.Input;
par.Value = null;
cmd.Parameters.Add(par);
}