Skip to content

Instantly share code, notes, and snippets.

View muzudho's full-sized avatar

むずでょ muzudho

View GitHub Profile
@muzudho
muzudho / file0.txt
Last active June 30, 2017 18:48
Unity 接地判定の線とか、見えない境界とか、見たくなったときは LineRendererで画面に線を引く ref: http://qiita.com/muzudho1/items/e6b02553f8186d80fb53
/// <summary>
/// 表示区画の枠
/// </summary>
[MenuItem("Tool/RefreshLineFrame")]
static void RefreshLineFrame()
{
// 枠
lineFrame = GameObject.Find("LineFrame");
transform_lineFrame = lineFrame.GetComponent<Transform>();
LineRenderer lineRenderer = lineFrame.GetComponent<LineRenderer>();
@muzudho
muzudho / file0.txt
Last active June 7, 2017 09:55
Unity2Dでアニメーターを使うとモーション遷移をプログラムから独立させることができる ref: http://qiita.com/muzudho1/items/f6519a58cfd7f681ac55
Project
|
+-- ゲームオブジェクト
~~~~~~~~~~~~~~~~
|
+-- スプライト・レンダラー
|
+-- アニメーター
@muzudho
muzudho / file0.txt
Last active June 8, 2017 18:24
ゲーム開発を受注しようぜ<その4> キャラクターのモーション遷移を作ろうぜ ref: http://qiita.com/muzudho1/items/44e66663be3323e556c9
![undefined]()
@muzudho
muzudho / file0.txt
Created June 5, 2017 22:16
Unityで2D格闘ゲームの歩行を作るならモーションのExit Time等を設定して足元が滑って見えないようにする ref: http://qiita.com/muzudho1/items/54ab596cb3749ab5b40f
void FixedUpdate()
{
#region 歩行
if (isGrounded)// 接地していれば
{
if (!this.IsJump1Motion)//ジャンプ時の屈伸中ではないなら
{
//左キー: -1、右キー: 1
float leverX = Input.GetAxisRaw(CommonScript.PlayerAndButton_To_ButtonName[playerIndex, (int)ButtonIndex.Horizontal]);
@muzudho
muzudho / file0.txt
Last active June 23, 2017 11:28
UnityでJSONを読み書きしようぜ(特にDictionaryで) ref: http://qiita.com/muzudho1/items/26bda7d5e3c8dfac304c
using UnityEngine;
[System.Serializable]
public class PlayerInfo
{
public string name;
public int lives;
public float health;
public static PlayerInfo CreateFromJSON(string jsonString)
@muzudho
muzudho / file0.txt
Last active June 5, 2017 21:48
Tiled Map Editor でタイルに地面フラグを設定しようぜ ref: http://qiita.com/muzudho1/items/1cb926c980b8327f093d
※前略
"tileheight":32,
"tilesets":[
{
"columns":32,
"firstgid":1,
"image":"..\/RunAndJump\/Assets\/Resources\/Sprites\/Textures\/Stage_32x32.png",
"imageheight":1024,
"imagewidth":1024,
"margin":0,
@muzudho
muzudho / file0.txt
Last active August 1, 2017 13:49
ゲーム開発を受注しようぜ<その1> 開発環境の準備 ref: http://qiita.com/muzudho1/items/d5d30619bf7f4102f7f1
@startuml
きふわらべ -> お父ん : 起きろ☆!
きふわらべ <- お父ん : 起きてるぜ☆!
@enduml
@muzudho
muzudho / file0.txt
Last active June 7, 2017 07:00
ゲーム開発を受注しようぜ<その3> Unity2Dで 画面の中にキャラクターを置こうぜ ref: http://qiita.com/muzudho1/items/4ee198296d620da0b8fa
// Tile1 ゲーム・オブジェクトを作る
GameObject go = new GameObject("Tile1", typeof(SpriteRenderer));
// 在るものから探す場合
// GameObject go = GameObject.Find("Tile1");
SpriteRenderer rend = go.GetComponent<SpriteRenderer>();
rend.sortingLayerName = "Ground";
@muzudho
muzudho / file0.txt
Last active June 5, 2017 14:28
Unityで2D格闘ゲームを作るときに欲しいと思われる、アニメのフレームと当たり判定の合わせ方 ref: http://qiita.com/muzudho1/items/b89a2ac150c39b6b3f60
// ヒットボックスのスプライト
void Update()
{
// ~略~
hitboxTransform.Translate(
offsetX - hitboxTransform.position.x,
offsetY - hitboxTransform.position.y,
hitboxTransform.position.z
);
@muzudho
muzudho / file0.txt
Last active June 6, 2017 15:19
Unity2Dでタイルマップを敷き詰めてスクロールさせようぜ ref: http://qiita.com/muzudho1/items/061944fdcc73008c822c
// 多分こんな感じで 上に行く
transform.Translate( 0, 200f, 0 );