summaryrefslogtreecommitdiff
path: root/src/objects/obj_control.cpp
blob: 87c685d45d0c992eca8836ef20d82de6307efaa6 (plain)
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
OUT #include <cstdlib>

static double yd=0;
static Object *hoiobj;

EVENT(create){
	draw_set_font(fnt_liber);
	x=10;
	y=240;
	hoiobj=instance_create<obj_hoi>(20,20);
}

EVENT(step){
	x++;
	y+=yd;
	yd+=(double)rand()/RAND_MAX*2-y/240;
	yd*=0.99;

	if(x==100){
		instance_destroy(hoiobj);
	} else if(x==200){
		instance_destroy(this);
		return;
	}
}

EVENT(draw){
	draw_textf(x,y,"controllll: x=%g y=%g",x,y);
}