# MinaCoding2023_Playful

# PlayingWithJewels

Today's MinaCoding Prompt is **Add an Element of Playful.** I will be coding with [***Hydra***](https://hydra.ojack.xyz/) and [SonicPi](https://sonic-pi.net/) to make ***PlayingWithJewels.***

* The **Hydra** code modulates and glitches the gameplay: [https://hydra.ojack.xyz/](https://hydra.ojack.xyz/) seen in the background of **"Microsoft Jewels 2"**
    
* The sounds are coded in SonicPi using the concept of shadow maths and colour shuffling as seen in [RedfulTints & Rediness Shades](https://blog.illestpreacha.com/minacoding2023red). This time we will be playing with Blues instead of Reds.
    

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/kAQBg--Vy60"></iframe>

## **Code**

### Hydra

```javascript
//Part 1
s0.initScreen()

src(s0).scale(0.2).kaleid(4).modulateRotate(s0,0.5).
rotate(()=> (time % 12) * 3).modulateScale(osc(3,1,1)).out()
speed = 0.05

//Part 2

s0.initScreen()

src(s0).scale(0.2).scrollX([0.5,0.3]).scrollY([0.5,0.3,0.1,-0.2])
.kaleid(4).modulateRotate(s0,0.5).rotate(()=> (time % 12) * 3)
.modulateScale(osc(3,1,1)).out()

speed = 0.05
```

### **SonicPi**

```ruby
#Color +Shadows
#RGB Values + XYZ

#Then slowed down to 30% of the regular sounds
#Shadeofred [R,G,B, X, Y, Z]

# CadetBlue : 95, 158, 160,23.29, 29.423,37.708
# SlateBlue : 106, 90, 205,20.617, 14.784, 59.521
# NavyBlue : 0, 0, 128,3.896, 1.558, 20.516

#shadow length equation is Length = height / tan(angle)


#Creating Arrays
CadetBlue = [95, 158, 160,23.29, 29.423,37.708]
SlateBlue = [106, 90, 205,20.617, 14.784, 59.521]
NavyBlue = [0, 0, 128,3.896, 1.558, 20.516]



with_fx :ixi_techno do
  live_loop :reds do
    i = 0
    use_synth :pretty_bell
    play (CadetBlue[i] + SlateBlue[i])/5 ,release: 3
    play CadetBlue[i] ,release: 3
    
    with_fx :ping_pong, mix: rrand(0.3,0.75) do
      use_synth :chiplead
      play (NavyBlue[i] + SlateBlue[i])/5 ,release: 3, decay: dice(4)
    end
    
    sleep [0.5,1,2].choose
    if i < 7
      i+= 1
    end
  end
end

live_loop :redshuffle do
  
  CadetBlueShuffle = CadetBlue.shuffle()
  SlateBlueShuffle = SlateBlue.shuffle()
  NavyBlueShuffle = NavyBlue.shuffle()
  
  i = 0
  use_synth :pretty_bell
  play (CadetBlueShuffle[i] + SlateBlueShuffle[i])/4 ,release: 3
  play CadetBlueShuffle[i] ,release: 3
  
  with_fx :ping_pong, mix: rrand(0.3,0.75) do
    use_synth :piano
    play (NavyBlueShuffle[i] + SlateBlueShuffle[i])/5 ,release: 3, decay: dice(4)
  end
  
  sleep [0.5,1,2].choose
  if i < 7
    i+= 1
  end
end


#shadow length component
with_fx :ixi_techno do
  live_loop :redsshadow do
    i = 0
    use_synth :piano
    play (CadetBlue[i]/Math.tan(70)).abs + (SlateBlue[i]/Math.tan(70)).abs  - 20,release: 3, sustain: 8
    sleep [0.25,0.5,1,2,4].choose
    if i < 7
      i+= 1
    end
  end
end
```
