-
Notifications
You must be signed in to change notification settings - Fork 58
/
Reed.as
executable file
·37 lines (29 loc) · 1.14 KB
/
Reed.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package
{
import flash.geom.Point;
import org.flixel.FlxSprite;
import org.flixel.FlxG;
import org.flixel.FlxObject;
import org.flixel.FlxPoint;
public class Reed extends FlxSprite{
[Embed(source='/assets/gfx/reed.png')] private var ReedImg:Class;
private var weather:Weather;
private var weatherChanged:Number = 0;
private var t:Number = 0;
public function Reed(X:int, Y:int){
super(X,Y);
loadGraphic(ReedImg, true, false, 32, 32);
this.weather = (FlxG.state as PlayState).weather;
}
override public function update():void{
t += weather.wind;
frame = int(3 * (0.5 + 0.5*Math.sin(0.05*t + x)) + 0.3 * Math.sin(0.2*t));
/*if (weather.changed > weatherChanged) {
weatherChanged = weather.t;
var wind:Number = weather.wind;
wind = wind * (0.5 + 0.5*Math.sin(x + weather.t*wind*3) + 0.3*Math.sin(x + weather.t*wind*5));
frame = int(3*(1-wind))
}*/
}
}
}