Skip to content

Instantly share code, notes, and snippets.

View ealbinu's full-sized avatar
🏠
Working from home

Albin Rodriguez ealbinu

🏠
Working from home
View GitHub Profile
@ealbinu
ealbinu / Loader.ts
Created February 1, 2024 20:15
Cargar textura remota y asignarla a atlas en cocos creator 3.8
import { _decorator, Component, Node, assetManager, SpriteFrame, Texture2D, Sprite, ImageAsset } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('Loader')
export class Loader extends Component {
// Atlas inicial
@property(cc.SpriteAtlas)
atlasInicial: cc.SpriteAtlas = null;
start() {
const self = this;
import { _decorator, Component, Node, Input, input, EventKeyboard, KeyCode } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('InputManager')
export class InputManager extends Component {
private static _instance: InputManager;
private _keyStates: Map<number, boolean> = new Map();
onLoad(){
console.log('INPUT MANAGER')
if(InputManager._instance){
@ealbinu
ealbinu / MoveIt-MovimientoLibre.ts
Created December 6, 2023 19:49
Cocos Creator - Movimiento libre de objeto
import { _decorator, Component, input, Input, Vec3, EventKeyboard, KeyCode } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('PlayerController')
export class PlayerController extends Component {
@property
public moveSpeed: number = 100;
private _direction: Vec3 = new Vec3();
private _keys: { [keyCode: number]: boolean } = {};
@ealbinu
ealbinu / MoveIt.ts
Created December 6, 2023 19:39
CocosCreator - Mover objeto
import { _decorator, Component, input, Input, Vec3, EventKeyboard, KeyCode } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('PlayerController')
export class PlayerController extends Component {
@property
public moveSpeed: number = 100;
private _direction: Vec3 = new Vec3();
@ealbinu
ealbinu / snippets.json
Last active May 6, 2022 13:45
VSCode Animate.css Snippets | anim (init) | anim_ (names) | animu (utilities)
{
"animationcssAnimated": {
"prefix": "anim",
"body":[
"animate__animated"
]
},
"animationcssAnimations": {
"prefix": "anim_",
"body":[
@ealbinu
ealbinu / PlayerScript.cs
Last active August 24, 2021 20:50
Unity - Clase 1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerScript : MonoBehaviour
{
private Rigidbody rb;
//Asignación de variables
void Start() {
@ealbinu
ealbinu / put.json
Created January 23, 2020 18:28
PUTVIAKESSS
// 20200120192633
// http://3.17.198.174:8000/api/viajes/8005
{
"folio": 8005,
"basis_id": 2,
"empleado_id": 2,
"cliente_id": 1,
"mercancia_id": 2,
"servicio_id": 19,
{
"folio": null,
"basis_id": 1,
"cliente_id": 1,
"mercancia_id": 1,
"servicio_id": 1,
"motriz_id": 1,
"proveedor_id": 41,
"arrastres_id": 2,
"empleadoNombre": "NA",
@ealbinu
ealbinu / Piggy.gd
Created January 17, 2020 00:15
Godot: Enemigo camina hacia la dirección del player
extends KinematicBody2D
# Velocidad a la que se acerca el enemigo
var velocidad = 150
# Distancia entre el enemigo y el player
var distancia = 250
var movcont = 0
@ealbinu
ealbinu / Menu.gd
Last active December 19, 2019 10:55
Cambiar de escena en Godot
extends Control
func _on_Button_pressed():
get_tree().change_scene("res://scenes/Nivel1.tscn")
pass # Replace with function body.