function update_env()
  while true do
    vector['my_hp'] = my_hp - previous['my_hp']
    vector['enemy_hp'] = enemy_hp - previous['enemy_hp']
    vector['my_act'] = my_act - previous['my_act']
    vector['enemy_act'] = enemy_act - previous['enemy_act']
    
    if vector['my_act']==0 then
      my_frame2 = my_frame2 + 1
    else
      my_frame2 = 1
    end
    if vector['enemy_act']==0 then
      enemy_frame2 = enemy_frame2 + 1
    else
      enemy_frame2 = 1
    end
    if (previous['my_act']<50 or previous['my_act']>=200) and
      ((my_act>=50 and my_act<110) or my_act==143)
    then
      is_damaged = true
    else
      is_damaged = false
    end
    
    previous['my_hp'] = my_hp
    previous['enemy_hp'] = enemy_hp
    previous['my_act'] = my_act
    previous['enemy_act'] = enemy_act
    yield()
  end
end
