Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Key Spawner
- --------------------------
- ~create
- arr_size = 10;
- rrange = 9;
- numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- //number of keys
- for (var i = 0; i < 3; i++) {
- spawn = irandom(rrange);
- switch(numbers[spawn]){
- case 0:
- instance_create_layer(304, 416, "keys", obj_key14);
- instance_create_layer(304, 416, "key_light", obj_key_light);
- break;
- case 1:
- instance_create_layer(335, 367, "keys", obj_key14);
- instance_create_layer(335, 367, "key_light", obj_key_light);
- break;
- case 2:
- instance_create_layer(335, 462, "keys", obj_key14);
- instance_create_layer(335, 462, "key_light", obj_key_light);
- break;
- case 3:
- instance_create_layer(271, 367, "keys", obj_key14);
- instance_create_layer(271, 367, "key_light", obj_key_light);
- break;
- case 4:
- instance_create_layer(271, 462, "keys", obj_key14);
- instance_create_layer(271, 461, "key_light", obj_key_light);
- break;
- case 5:
- instance_create_layer(271, 622, "keys", obj_key14);
- instance_create_layer(271, 622, "key_light", obj_key_light);
- break;
- case 6:
- instance_create_layer(271, 175, "keys", obj_key14);
- instance_create_layer(271, 175, "key_light", obj_key_light);
- break;
- case 7:
- instance_create_layer(334, 239, "keys", obj_key14);
- instance_create_layer(334, 239, "key_light", obj_key_light);
- break;
- case 8:
- instance_create_layer(334, 623, "keys", obj_key14);
- instance_create_layer(334, 623, "key_light", obj_key_light);
- break;
- case 9:
- instance_create_layer(464, 430, "keys", obj_key14);
- instance_create_layer(464, 430, "key_light", obj_key_light);
- break;
- }
- rrange--;
- arr_size--;
- array_delete(numbers, spawn, 1);
- array_resize(numbers, arr_size);
- image_xscale = 0.5;
- image_yscale = 0.5;
- }
- Actual Key
- ----------------
- Create
- image_xscale = 0.5;
- image_yscale = 0.5;
- timer = 0;
- frequency = 0.1;
- amplitude = 0.3;
- Step
- y = y + sin(timer*frequency)*amplitude;
- timer++;
- Collision with player
- audio_sound_pitch(snd_close, 1.5);
- audio_play_sound(snd_close, 8, false);
- instance_destroy(self);
- obj_player.keys++;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement