Skip to content

Instantly share code, notes, and snippets.

@bamacken
bamacken / StringReverse.c
Last active April 9, 2019 23:21
C-Code demonstrates in-place strings reverse.
#include "pch.h"
#include <iostream>
// Implement "reverse" to reverse the passed string in-place.
void reverse(char *string)
{
int length = strlen(string); // cache string length
int j = 0; // first to last increment
// loop over string elements, last to first
@bamacken
bamacken / CameraInfluence.cs
Last active March 6, 2024 17:43
Unity - Weighted 2D Camera movement based on the influence of "interest points".
//usage: Set Camera to Orthographic and use CameraInfluence.AddInfluence(gameObject,influence);
//permanent interest points such as onscreen players should have influence set to 0.5f
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
public class CameraInfluence : MonoBehaviour
{