source: 2011/23/tojukarp/EuroPacman/EuroPacman/EuroPacman/CrazyObject.cs @ 10335

Revision 1842, 712 bytes checked in by tojukarp, 8 years ago (diff)

EuroPacman?

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Jypeli;
6
7public class CrazyObject : PhysicsObject
8{
9    public double Vibration { get; set; }
10
11    public CrazyObject(double width, double height, double vibration)
12        : base(width, height)
13    {
14        Vibration = vibration;
15
16        Timer vibrateTimer = new Timer();
17        vibrateTimer.Interval = 0.01;
18        vibrateTimer.Trigger += new Timer.TriggerHandler(Vibrate);
19        vibrateTimer.Start();
20    }
21
22    void Vibrate(Timer sender)
23    {
24        Vector d = Vector.FromLengthAndAngle(RandomGen.NextDouble(0, Vibration), RandomGen.NextAngle());
25        Position += d;
26    }
27}
Note: See TracBrowser for help on using the repository browser.