Apr
24
2010
function characterCode(){ var $char = document.getElementById('charInput').value.charCodeAt(0); document.getElementById('charOutput').innerHTML = $char; document.getElementById('charInput').value = ""; }
<input id="charInput" onkeyup="characterCode();" size="1" type="text" />
<div id="charOutput"></div>
Comments Off | posted in Javascript
Apr
20
2010
function truncateString($string, $limit){
if(strlen($string) <= $limit) return $string;
while (strlen($string) > $limit){
$string = substr($string, 0, -1);
}
$string = $string . “…”;
return $string;
}
Comments Off | posted in Php
Apr
11
2010
var rotateSpeed : float = 5.0;
function Update () {
transform.Rotate (0.0, 0.0, rotateSpeed * Time.deltaTime);
}
Comments Off | tags: Gaming, Rotate, Tutorial, Unity3d
Apr
11
2010
Button w/t TextureScript.cs
using UnityEngine;
using System.Collections;
public class TextureScript : MonoBehaviour {
public Texture myTexture;
void OnGUI () {
if (GUI.Button (new Rect (10,10,myTexture.width,myTexture.height), myTexture)) {
print("Button Pressed");
}
}
}
Button w/t TextureScript.js
var myTexture:Texture;
function OnGUI () {
if (GUI.Button (new Rect (10,10,myTexture.width,myTexture.height), myTexture)) {
print("Button Pressed");
}
}
no comments | tags: Button, GUI.Button, Textured, Unity3d | posted in Unity3d
Apr
11
2010
Comments Off | posted in Unity3d
Mar
22
2010
var target : Transform;
var MouseWheelSensitivity = 5;
var MouseZoomMin = 1;
var MouseZoomMax = 7;
private var x = 0.0;
private var y = 0.0;
private var distance = 5.0;
function Start (){
var playerAngle = transform.eulerAngles;
x = playerAngle.y;
y = playerAngle.x;
}
function LateUpdate (){
if (Input.GetAxis("Mouse ScrollWheel") != 0) {
//Debug.Log(Input.GetAxis("Mouse ScrollWheel"));
//Debug.Log(distance);
if (distance >= MouseZoomMin && distance <= MouseZoomMax){
distance -= Input.GetAxis("Mouse ScrollWheel") * MouseWheelSensitivity;
if (distance < MouseZoomMin){distance = MouseZoomMin;}
if (distance > MouseZoomMax){distance = MouseZoomMax;}
}
}
rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(y, x, 0), Time.deltaTime * 3);
position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
Comments Off | tags: Mouse, Unity3d, Wheel, Zoom | posted in Unity3d
Dec
17
2009
setTimeout("myFunction(myVariable)",1250);
Timeout is in milliseconds, 1 Second = 1000 Milliseconds.
Example:
setTimeout("alert('Beep')",1250);
Comments Off | posted in Javascript
Aug
2
2009
//*1 Create a variable to store the color transformation named '$newColor'
//*2 Assign the new color
//*3 Assign the new color to your MovieClip named '$myMovieClip'
//*1
var $newColor:ColorTransform = new ColorTransform();
//*2
$newColor.color = (0xFFFFFF);
//*3
$myMovieClip.transform.colorTransform = $newColor;
Comments Off
May
17
2009
Based on how quickly you can play games once clicked, with minimal re-directs or ads. (Updated Often)
Kongregate: http://www.kongregate.com/
Miniclip: http://www.miniclip.com/games/en/
CrazyMonkeyGames: http://www.crazymonkeygames.com/
Comments Off