Skip to content

Instantly share code, notes, and snippets.

View setanarut's full-sized avatar

Barış setanarut

  • Türkiye
View GitHub Profile
@setanarut
setanarut / dda.go
Created December 7, 2024 23:08
Raycast performs the DDA (Digital Differential Analysis) algorithm to find intersections with a tile map
package main
import "math"
// RaycastHit structure stores the result of the DDA (Digital Differential Analysis) raycast operation
type RaycastHit struct {
// Indicates whether the ray hit something
Hit bool
// The distance from origin to the hit point
@setanarut
setanarut / PlayerController_States.h
Created December 6, 2024 00:12 — forked from tomdalling/PlayerController_States.h
Some code from a state machine for Oddworld-style platform movement.
//
// Copyright 2012. All rights reserved.
//
static const int StandingHeight = 2;
static const int CrouchingHeight = 1;
class State {
public:
extends KinematicBody2D
export var move_speed = 200.0
var velocity := Vector2.ZERO
export var jump_height : float
export var jump_time_to_peak : float
export var jump_time_to_descent : float
@setanarut
setanarut / vec.go
Last active November 12, 2024 13:55
Vector2 package for Go language
package v
import (
"fmt"
"math"
)
var (
// One vector, a vector with all components set to 1.
One = Vec{1, 1}