Skip to content

Instantly share code, notes, and snippets.

@pixelage
pixelage / MouseLook.cs
Created January 10, 2020 06:45
[Unity First Person Controller]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSensitivity = 100f;
public Transform playerBody;
@pixelage
pixelage / Key.cs
Last active December 12, 2022 18:48
[Unity Key/Door System]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Key : MonoBehaviour
{
[SerializeField] private KeyType keyType;
public enum KeyType
@pixelage
pixelage / Create - Variables
Created December 27, 2019 11:12
[Revized Basic Movement]
/// @desc Variable
state = State.Movement;
acceleration = 1;
jump_height = 14;
fric = 0.3;
left = vk_left;
right = vk_right;
jump = vk_space;
@pixelage
pixelage / call object (script)
Created May 27, 2019 18:41
[Room Transition]
/// @desc slide_transition(mode, targetroom)
/// @arg mode sets transition mode between next, restart and goto.
/// @arg targetroom sets target room when using the goto mode
with (oTransition)
{
mode = argument[0];
if (argument_count > 1) target = argument[1];
}
@pixelage
pixelage / alarm 0
Created May 25, 2019 05:50
[Hit Box]
instance_destroy();
@pixelage
pixelage / nine_slice_box
Created May 25, 2019 05:29
[Slice Box]
///@desc nine_slice_box(sprite, x1, y1, x2, y2);
///@arg sprite
///@arg x1
///@arg y1
///@arg x2
///@arg y2
var _size = sprite_get_width(argument0) / 3;
var _x1 = argument1;
@pixelage
pixelage / animation_end
Last active May 17, 2023 11:52
[Generic Scripts]
/// disc animation_end(sprite, image, rate);
// or just animation_end();
/// @arg sprite
/// @arg image
/// @arg rate
var _sprite = sprite_index;
var _image = image_index;
@pixelage
pixelage / Alarm
Created May 25, 2019 03:29
[Camera Script]
window_center();
@pixelage
pixelage / create_01.gml
Last active May 17, 2023 11:56
[Game Menu 02]
// Basic Variables
menu_x = x;
menu_y = y;
button_h = 24;
button_w =190;
button_padding = 10;
menu_index = 0;
last_selected = 0;
// Button Array
@pixelage
pixelage / create_0.gml
Last active May 17, 2023 11:56
[Game Menu 01] Basic game menu nothing fancy #gml #gms2 #menu
menu_x = x;
menu_y = y;
button_h = 32;
button[0] = "New Game";
button[1] = "Load Game";
button[2] = "Options";
button[3] = "Exit Game";
buttons = array_length_1d(button);