Code-library :: cursor.as

Contenu du snippet

voici le premier fichier d'une librairie de fonction que je suis en train de creer.
certaines fonctions sont de moi, d'autres viennent de differents sites.
Ce fichier est en construction perpetuel.
il n'y a ici que les fonctions dont je me suis le plus servi dans mes projets.
ce fichier contient des fichier permettant de gerer le curseur :: vitesse, direction, etc...

Source / Exemple :


////
/*
description	Cursor functions :: velocity, direction, etc...
filename	Cursor.as
Author 		BlackWizzard 
Contact		postmater@blackwizzard.com
url		http://laboratory.blackwizzard.com
created		14/02/03
last modified	16/02/03

  • /
/* :: Cursor velocity :: */ movieclip.prototype.cursor_velocity = function() { cursor_old_x = cursor_new_x; cursor_old_y = cursor_new_y; cursor_new_x = int(this._xmouse); cursor_new_y = int(this._ymouse); cursor_velocity = int(Math.sqrt(Math.pow(cursor_new_x - cursor_old_x, 2) + Math.pow(cursor_new_y - cursor_old_y, 2))); return cursor_velocity; }; /* :: Cursor orientation :: */ movieclip.prototype.cursor_orientation = function() { cursor_old_x = cursor_new_x; cursor_old_y = cursor_new_y; cursor_new_x = int(_xmouse); cursor_new_y = int(_ymouse); cursor_distance_x = cursor_new_x - cursor_old_x; cursor_distance_y = cursor_new_y - cursor_old_y; cursor_orientation = -(90 * Math.atan2(cursor_distance_x, cursor_distance_y) / (Math.PI / 2)); //if (this.cursor_velocity() != 0) { return cursor_orientation; //} }; /* :: Cursor vx :: */ movieclip.prototype.get_cursor_vx = function() { this.cursor_old_x = this.cursor_new_x; this.cursor_new_x = int(_xmouse); this.cursor_distance_x = this.cursor_new_x - this.cursor_old_x; return this.cursor_distance_x; }; /* :: Cursor vy :: */ movieclip.prototype.get_cursor_vy = function() { this.cursor_old_y = this.cursor_new_y; this.cursor_new_y = int(_ymouse); this.cursor_distance_y = this.cursor_new_y - this.cursor_old_y; return this.cursor_distance_y; };

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.